fysxasteroids/engine/Logging.h

37 lines
893 B
C++

#ifndef _LOGGING_H
#define _LOGGING_H
#include "Engine.h"
namespace Engine {
class Module;
/** \brief All logging goes through this class
*/
class Logging : public Module {
public:
void Log (LogLevel level, const char *str, ...);
void SetLogPrintLevel (LogLevel print_level);
void SetLogFilename (const char *filename);
/** \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;
std::ofstream mLogFileOut;
};
}
#endif // _LOGGING_H