| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#ifndef __LOG_H__ |
| 32 |
#define __LOG_H__ |
| 33 |
|
| 34 |
class t_Log |
| 35 |
{ |
| 36 |
public: |
| 37 |
typedef enum |
| 38 |
{ |
| 39 |
Debug=0, |
| 40 |
Info, |
| 41 |
Error, |
| 42 |
|
| 43 |
Entries |
| 44 |
} t_Level; |
| 45 |
|
| 46 |
|
| 47 |
t_Log (const char* pFileName, APIRET &rc); |
| 48 |
~t_Log (void); |
| 49 |
|
| 50 |
static bool IsInitialised (void); |
| 51 |
static void GetLibGuyToolsVersion (const char **pVersion); |
| 52 |
|
| 53 |
static void vEntry (t_Level Level, const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, va_list pArguments); |
| 54 |
static void Entry (t_Level Level, const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, ...) __attribute__ ((format (printf, 5, 6))); |
| 55 |
static void vEntryDebug (const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, va_list pArguments); |
| 56 |
static void vEntryInfo (const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, va_list pArguments); |
| 57 |
static void vEntryError (const char *pFileName, const char *pFunctionName, int LineNr, const char *pFormat, va_list pArguments); |
| 58 |
|
| 59 |
#define LOG_DEBUG(...) t_Log::Entry (t_Log::Debug, __FFL__, __VA_ARGS__); |
| 60 |
#define LOG_INFO(...) t_Log::Entry (t_Log::Info , __FFL__, __VA_ARGS__); |
| 61 |
#define LOG_ERROR(...) t_Log::Entry (t_Log::Error, __FFL__, __VA_ARGS__); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
static const APIRET TOOLLOG_ERROR_INITIALISED_TWICE = ERROR_BASE_TOOL_LOG + 1; |
| 66 |
static const APIRET TOOLLOG_ERROR_HOSTNAME_TOO_LONG = ERROR_BASE_TOOL_LOG + 2; |
| 67 |
}; |
| 68 |
|
| 69 |
#endif |
| 70 |
|