00001
00002 #ifndef __FILELOGGER_H_
00003 #define __FILELOGGER_H_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "peonstdafx.h"
00027
00028 #include "ISingleton.h"
00029
00030
00040 #define PEON_LOG_INFO 0x0001
00041 #define PEON_LOG_DEBUG 0x0002
00042 #define PEON_LOG_ERROR 0x0004
00043 #define PEON_LOG_FATAL 0x0008
00044
00045
00046 namespace peon {
00047
00060 class PEONMAIN_API FileLogger : public ISingleton<FileLogger>
00061 {
00062
00063 protected:
00064
00066 std::ofstream m_log_file;
00067
00069 String m_strLogName;
00070
00072 int m_logging_level;
00073
00074 protected:
00075
00082 void writeToLogStream(const String& strText);
00083
00084
00085 public:
00086
00091 FileLogger( int log_flag = PEON_LOG_DEBUG );
00092
00096 ~FileLogger();
00097
00113 static FileLogger& getSingleton(void);
00114
00130 static FileLogger* getSingletonPtr(void);
00131
00138 bool openLogStream(const String& strName);
00139
00146 void closeLogStream(void);
00147
00155 void logInfo ( const String& strObject, const String& strText);
00156
00164 void logDebug(const String& strObject, const String& strText);
00165
00173 void logError(const String& strObject, const String& strText);
00174
00182 void logFatal( const String& strObject, const String& strText);
00183
00184
00185
00186 };
00187 }
00188
00189 #endif