version 1.1.2.9, 2007/01/17 18:48:53
|
version 1.2, 2007/05/25 18:35:07
|
|
|
| |
static enum LogLevel _level = LL_INFORMATION; | static enum LogLevel _level = LL_INFORMATION; |
| |
void OpenLog(const char* ident, int perror) |
void OpenLog(const char* ident) |
{ | { |
int options = LOG_PID; | int options = LOG_PID; |
| |
#if defined(PEGASUS_OS_LINUX) |
|
if (perror) |
|
options |= LOG_PERROR; |
|
#else |
|
perror = 0; |
|
#endif |
|
|
|
openlog(ident, options, LOG_DAEMON); | openlog(ident, options, LOG_DAEMON); |
} | } |
| |
|
|
| |
void Log(enum LogLevel type, const char *format, ...) | void Log(enum LogLevel type, const char *format, ...) |
{ | { |
|
/* These definitions are consistent with System::syslog in |
|
SystemPOSIX.cpp. */ |
static int _priorities[] = | static int _priorities[] = |
{ | { |
LOG_ALERT, /* LL_FATAL, */ |
LOG_CRIT, /* LL_FATAL, */ |
LOG_CRIT, /* LL_SEVERE */ |
LOG_ERR, /* LL_SEVERE */ |
LOG_WARNING, /* LL_WARNING */ | LOG_WARNING, /* LL_WARNING */ |
LOG_NOTICE, /* LL_INFORMATION */ |
LOG_INFO, /* LL_INFORMATION */ |
LOG_INFO, /* LL_TRACE */ |
LOG_DEBUG, /* LL_TRACE */ |
}; | }; |
|
|
static const char* _prefix[] = | static const char* _prefix[] = |
{ | { |
"FATAL", | "FATAL", |
|
|
"INFORMATION", | "INFORMATION", |
"TRACE" | "TRACE" |
}; | }; |
|
|
char prefixedFormat[EXECUTOR_BUFFER_SIZE]; | char prefixedFormat[EXECUTOR_BUFFER_SIZE]; |
| |
/* Prefix the format with the log level. */ | /* Prefix the format with the log level. */ |