BESLog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef BESLog_h_
00034 #define BESLog_h_ 1
00035
00036 #include <fstream>
00037 #include <string>
00038
00039 using std::ofstream ;
00040 using std::ios ;
00041 using std::ostream ;
00042 using std::string ;
00043
00044 #include "BESObj.h"
00045
00087 class BESLog : public BESObj
00088 {
00089 private:
00090 static BESLog * _instance ;
00091 int _flushed ;
00092 ofstream * _file_buffer ;
00093 string _file_name ;
00094
00095 int _suspended ;
00096
00097 bool _verbose ;
00098 protected:
00099 BESLog();
00100
00101
00102 void dump_time() ;
00103 public:
00104 ~BESLog();
00105
00111 void suspend()
00112 {
00113 _suspended = 1 ;
00114 }
00115
00121 void resume()
00122 {
00123 _suspended = 0 ;
00124 }
00125
00132 void verbose_on()
00133 {
00134 _verbose = true ;
00135 }
00136
00142 void verbose_off()
00143 {
00144 _verbose = false ;
00145 }
00146
00162 bool is_verbose()
00163 {
00164 return _verbose ;
00165 }
00166
00168 typedef ios& (*p_ios_manipulator) (ios&);
00170 typedef ostream& (*p_ostream_manipulator) (ostream&);
00171
00172 BESLog& operator << (string&);
00173 BESLog& operator << (const string&);
00174 BESLog& operator << (char*);
00175 BESLog& operator << (const char*);
00176 BESLog& operator << (int);
00177 BESLog& operator << (char);
00178 BESLog& operator << (long);
00179 BESLog& operator << (unsigned long);
00180 BESLog& operator << (double);
00181
00182 BESLog& operator<<(p_ostream_manipulator);
00183 BESLog& operator<<(p_ios_manipulator);
00184
00185 virtual void dump( ostream &strm ) const ;
00186
00187 static BESLog *TheLog() ;
00188 };
00189
00190 #endif // BESLog_h_
00191