/** \file * Game Develop * 2008-2012 Florian Rival (Florian.Rival@gmail.com) */ #ifndef LOGFILEMANAGER_H #define LOGFILEMANAGER_H /** * \brief Offer a simple way to write to a log file. * * \note The log file is only used for logging some specific tasks and is not exhaustive. Developers should refer to the console output. */ class LogFileManager { public: /** * Write the string into the log file if the log file is activated. */ void WriteToLogFile(const std::string & log); /** * Check if the log file is activated and get the log filename from wxConfigBase. Clear the log file if needed. */ void InitalizeFromConfig(); /** * Return true if the log file is activated */ bool IsLogActivated() { return logActivated; } static LogFileManager *GetInstance() { if ( NULL == _singleton ) { _singleton = new LogFileManager; } return ( static_cast( _singleton ) ); } static void DestroySingleton() { if ( NULL != _singleton ) { delete _singleton; _singleton = NULL; } } private: std::string logFile; bool logActivated; LogFileManager() {}; virtual ~LogFileManager() {}; static LogFileManager *_singleton; }; #endif // LOGFILEMANAGER_H