Go to the documentation of this file.00001 #ifndef __BCLOG__H
00002 #define __BCLOG__H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <iostream>
00025
00026
00027
00028 class BCLog
00029 {
00030 public:
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 enum LogLevel {debug, detail, summary, warning, error, nothing};
00045
00046
00047
00048
00049
00050 BCLog();
00051
00052
00053
00054 ~BCLog();
00055
00056
00057
00058
00059
00060
00061 static BCLog::LogLevel GetLogLevelFile()
00062 { return fMinimumLogLevelFile; };
00063
00064
00065
00066
00067 static BCLog::LogLevel GetLogLevelScreen()
00068 { return fMinimumLogLevelScreen; };
00069
00070
00071
00072
00073
00074
00075 static void SetLogLevelFile(BCLog::LogLevel loglevel)
00076 { BCLog::fMinimumLogLevelFile = loglevel; };
00077
00078
00079
00080
00081 static void SetLogLevelScreen(BCLog::LogLevel loglevel)
00082 { BCLog::fMinimumLogLevelScreen = loglevel; };
00083
00084
00085
00086
00087 static void SetLogLevel(BCLog::LogLevel loglevel)
00088 { BCLog::fMinimumLogLevelFile = loglevel; BCLog::fMinimumLogLevelScreen = loglevel; };
00089
00090
00091
00092
00093
00094
00095
00096
00097 static void OpenLog(const char * filename, BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen);
00098
00099 static void OpenLog(const char * filename);
00100
00101 static void OpenLog();
00102
00103
00104
00105 static bool IsOpen();
00106
00107
00108
00109 static void CloseLog();
00110
00111
00112
00113
00114
00115
00116 static void Out(BCLog::LogLevel loglevelfile, BCLog::LogLevel loglevelscreen, const char * message);
00117
00118 static void Out(const char * message);
00119
00120 static void Out(BCLog::LogLevel loglevel, const char * message)
00121 { Out(loglevel,loglevel,message); };
00122
00123 static void OutError(const char * message)
00124 { Out(error,message); };
00125
00126 static void OutWarning(const char * message)
00127 { Out(warning,message); };
00128
00129 static void OutSummary(const char * message)
00130 { Out(summary,message); };
00131
00132 static void OutDetail(const char * message)
00133 { Out(detail,message); };
00134
00135 static void OutDebug(const char * message)
00136 { Out(debug,message); };
00137
00138
00139
00140 static void StartupInfo();
00141
00142
00143
00144 static const char * GetVersion()
00145 { return fVersion; };
00146
00147
00148
00149 static int GetHIndex()
00150 { return BCLog::fHindex++; };
00151
00152 private:
00153
00154
00155
00156 static const char * fVersion;
00157
00158
00159
00160 static BCLog::LogLevel fMinimumLogLevelFile;
00161
00162
00163
00164 static BCLog::LogLevel fMinimumLogLevelScreen;
00165
00166
00167
00168 static std::ofstream fOutputStream;
00169
00170
00171
00172 static bool fFirstOutputDone;
00173
00174
00175
00176 static const char * ToString(BCLog::LogLevel);
00177
00178
00179
00180 static int fHindex;
00181 };
00182
00183
00184
00185 #endif