fysxasteroids/engine/Logging.h

44 lines
1.1 KiB
C
Raw Normal View History

2010-04-05 23:38:59 +02:00
#ifndef _LOGGING_H
#define _LOGGING_H
#include "Engine.h"
namespace Engine {
2010-04-05 23:38:59 +02:00
class Module;
/** \brief All logging goes through this class
2010-04-08 20:04:39 +02:00
*
* Only log messages higher or equal that of mPrintLevel are printed out. When
* a log filename was specified by Logging::SetLogFilename() then all messages
* sent to the Logging class are written to the file.
*
* \TODO Add log level for files separately
2010-04-05 23:38:59 +02:00
*/
class Logging : public Module {
public:
void Log (LogLevel level, const char *str, ...);
void SetLogPrintLevel (LogLevel print_level);
2010-04-08 19:34:57 +02:00
void SetLogFilename (const char *filename);
2010-04-05 23:38:59 +02:00
/** \brief Returns the last LogEntry that was sent to the Logging module
*/
const LogEntry& GetLastEntry ();
protected:
/** \brief Initializes the system */
virtual int OnInit (int argc, char* argv[]);
/** \brief Destroys the system (must be called!) */
virtual void OnDestroy ();
private:
LogLevel mPrintLevel;
/** \brief Stores all log messages that were sent to the Logging module
* \todo Restrict the number of entries to be stored!
*/
std::vector<LogEntry> mLogEntries;
2010-04-08 19:34:57 +02:00
std::ofstream mLogFileOut;
2010-04-05 23:38:59 +02:00
};
}
#endif // _LOGGING_H