|
发表于 2003-12-29 15:43:57
|
显示全部楼层
[code:1]
class Logger
{
Timing m_timing; /*!< timer to print timing information */
char m_buf[MAX_LOG_LINE]; /*!< buffer needed by different methods */
set<int> m_setLogLevels; /*!< set that contains all log levels */
char m_strHeader[MAX_HEADER];/*!< header string printed before msg */
ostream* m_os; /*!< output stream to print messages to */
public:
Logger( ostream& os=cout, int iMinLogLevel=0, int iMaxLogLevel = 0);
// different methods associated with logging messages
bool log ( int iLevel, string str );
bool log ( int i, char *str, ... );
bool logWithTime ( int iLevel, char *str, ... );
void restartTimer ( );
Timing getTiming ( );
bool isInLogLevel ( int iLevel );
bool addLogLevel ( int iLevel );
bool addLogRange ( int iMin, int iMax );
char* getHeader ( );
bool setHeader ( char *str );
bool setHeader ( int i1, int i2 );
bool setOutputStream ( ostream& os );
ostream& getOutputStream ( );
void showLogLevels ( ostream& os );
};
[/code:1] |
|