22 #define REGISTER_LOG_MODULE(name) \ 23 std::string GetModuleName() const \ 36 typedef std::auto_ptr<CFileLog> CFileLogPtr;
46 int Init(
const std::string& _LogFileName,
47 bool _CreateNew =
false,
52 throw std::logic_error(
"Log's singleton class has been already initialized.");
54 m_log = CFileLogPtr(
new CFileLog(_LogFileName, _CreateNew, _logLevel));
64 unsigned long _ErrorCode,
65 const std::string& _Module,
66 const std::string& _Message)
70 std::cerr << _Message << std::endl;
73 m_log->push(_Severity, _ErrorCode, _Module, _Message);
77 return (NULL != m_log.get());
100 template <
typename _T>
119 void InfoLog(
unsigned long _ErrorCode,
const std::string& _Message)
123 void WarningLog(
unsigned long _ErrorCode,
const std::string& _Message)
127 void FaultLog(
unsigned long _ErrorCode,
const std::string& _Message)
135 void DebugLog(
unsigned long _ErrorCode,
const std::string& _Message)
145 std::string GetModuleName()
147 _T* pT = reinterpret_cast<_T*>(
this);
148 return pT->GetModuleName();
Logging to a file.
Definition: Log.h:148
void WarningLog(unsigned long _ErrorCode, const std::string &_Message)
Definition: LogImp.h:123
void InfoLog(unsigned long _ErrorCode, const std::string &_Message)
Definition: LogImp.h:119
bool IsReady()
Definition: LogImp.h:75
enum MiscCommon::ESeverity LOG_SEVERITY
Log's severity's constants.
Template class. High-end helper implementation of CLog, its ofstream specialization.
Definition: LogImp.h:101
const LPCSTR g_cszMODULENAME_CORE("CORE")
~CLogImp()
Definition: LogImp.h:110
#define _T(s)
Use TCHAR instead of char or wchar_t. It will be appropriately translated.
Definition: def.h:85
It represents logbook as a singleton.
Definition: LogImp.h:34
void msgPush(LOG_SEVERITY _Severity, const std::string &_Message, unsigned long _ErrorCode=0)
Definition: LogImp.h:139
void push(LOG_SEVERITY _Severity, unsigned long _ErrorCode, const std::string &_Module, const std::string &_Message)
Definition: LogImp.h:63
void FaultLog(unsigned long _ErrorCode, const std::string &_Message)
Definition: LogImp.h:127
void DebugLog(unsigned long _ErrorCode, const std::string &_Message)
Definition: LogImp.h:135
CLogImp()
Definition: LogImp.h:104
void InfoLog(const std::string &_Message)
Definition: LogImp.h:115
static CLogSingleton & Instance()
Definition: LogImp.h:58
int Init(const std::string &_LogFileName, bool _CreateNew=false, unsigned char _logLevel=LOG_SEVERITY_INFO|LOG_SEVERITY_WARNING|LOG_SEVERITY_FAULT|LOG_SEVERITY_CRITICAL_ERROR)
Definition: LogImp.h:46
Miscellaneous functions and helpers are located here.
Definition: BOOST_FILESYSTEM.h:21
void CriticalErrLog(unsigned long _ErrorCode, const std::string &_Message)
Definition: LogImp.h:131