2012-07-10 13:31:17 +02:00
|
|
|
#include "i2-base.h"
|
|
|
|
|
2012-07-15 13:13:19 +02:00
|
|
|
#ifndef _WIN32
|
2012-07-10 13:31:17 +02:00
|
|
|
using namespace icinga;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a log entry and outputs it to syslog.
|
|
|
|
*
|
|
|
|
* @param entry The log entry.
|
|
|
|
*/
|
|
|
|
void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
|
|
|
|
{
|
|
|
|
int severity;
|
|
|
|
switch (entry.Severity) {
|
|
|
|
case LogDebug:
|
|
|
|
severity = LOG_DEBUG;
|
|
|
|
break;
|
|
|
|
case LogInformation:
|
|
|
|
severity = LOG_INFO;
|
|
|
|
break;
|
|
|
|
case LogWarning:
|
|
|
|
severity = LOG_WARNING;
|
|
|
|
break;
|
|
|
|
case LogCritical:
|
|
|
|
severity = LOG_CRIT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(!"Invalid severity specified.");
|
|
|
|
}
|
|
|
|
|
2012-08-02 09:38:08 +02:00
|
|
|
syslog(severity | LOG_USER, "%s", entry.Message.CStr());
|
2012-07-10 13:31:17 +02:00
|
|
|
}
|
2012-07-27 16:05:02 +02:00
|
|
|
#endif /* _WIN32 */
|