Go to the documentation of this file.00001 #ifndef __BCLOG__H
00002 #define __BCLOG__H
00003
00022
00023
00024 #include <iostream>
00025
00026
00027
00028 class BCLog
00029 {
00030 public:
00031
00032
00033
00044 enum LogLevel {debug, detail, summary, warning, error, nothing};
00045
00046
00047
00050 BCLog();
00051
00054 ~BCLog();
00055
00056
00057
00061 static BCLog::LogLevel GetLogLevelFile()
00062 { return fMinimumLogLevelFile; };
00063
00067 static BCLog::LogLevel GetLogLevelScreen()
00068 { return fMinimumLogLevelScreen; };
00069
00070
00071
00075 static void SetLogLevelFile(BCLog::LogLevel loglevel)
00076 { BCLog::fMinimumLogLevelFile = loglevel; };
00077
00081 static void SetLogLevelScreen(BCLog::LogLevel loglevel)
00082 { BCLog::fMinimumLogLevelScreen = loglevel; };
00083
00088 static void SetLogLevel(BCLog::LogLevel loglevelscreen, BCLog::LogLevel loglevelfile)
00089 { BCLog::fMinimumLogLevelFile = loglevelfile; BCLog::fMinimumLogLevelScreen = loglevelscreen; };
00090
00094 static void SetLogLevel(BCLog::LogLevel loglevel)
00095 { SetLogLevel(loglevel, loglevel); };
00096
00097
00098
00104 static void OpenLog(const char * filename, BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen);
00105
00106 static void OpenLog(const char * filename);
00107
00108 static void OpenLog();
00109
00112 static bool IsOpen();
00113
00116 static void CloseLog();
00117
00123 static void Out(BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen, const char * message);
00124
00125 static void Out(const char * message);
00126
00127 static void Out(BCLog::LogLevel loglevel, const char * message)
00128 { Out(loglevel,loglevel,message); };
00129
00130 static void OutError(const char * message)
00131 { Out(error,message); };
00132
00133 static void OutWarning(const char * message)
00134 { Out(warning,message); };
00135
00136 static void OutSummary(const char * message)
00137 { Out(summary,message); };
00138
00139 static void OutDetail(const char * message)
00140 { Out(detail,message); };
00141
00142 static void OutDebug(const char * message)
00143 { Out(debug,message); };
00144
00147 static void StartupInfo();
00148
00151 static const char * GetVersion()
00152 { return fVersion; };
00153
00156 static int GetHIndex()
00157 { return BCLog::fHindex++; };
00158
00161 static const char * ToString(BCLog::LogLevel);
00162
00163 private:
00164
00167 static const char * fVersion;
00168
00171 static BCLog::LogLevel fMinimumLogLevelFile;
00172
00175 static BCLog::LogLevel fMinimumLogLevelScreen;
00176
00179 static std::ofstream fOutputStream;
00180
00183 static bool fFirstOutputDone;
00184
00187 static int fHindex;
00188 };
00189
00190
00191
00192 #endif