SyslogAppender.cpp

Go to the documentation of this file.
00001 #include <fesa-core-gsi/Diagnostic/SyslogAppender.h>
00002 #include <cmw-log/LogMessage.h>
00003 #include <syslog.h>
00004 
00005 namespace fesaGSI
00006 {
00007 
00008 SyslogAppender::SyslogAppender(const std::string& name,
00009                bool synchronous,
00010                const CMW::Log::Appender::Filters& filters) :
00011     CMW::Log::Appender(name, synchronous, filters),
00012     facility_(LOG_LOCAL0)
00013 {
00014 
00015 }
00016 
00017 void SyslogAppender::doOutput(const CMW::Log::LogMessage & msg)
00018 {
00019         int severity;
00020         CMW::Log::Level::LogLevel logLevel = msg.getLevel();
00021         switch(logLevel)
00022         {
00023                 case CMW::Log::Level::LL_AUDIT:
00024                         //we dont log anything
00025                         return;
00026                         break;
00027                 case CMW::Log::Level::LL_ERROR:
00028                         severity = LOG_ERR;
00029                         break;
00030                 case CMW::Log::Level::LL_WARNING:
00031                         severity = LOG_WARNING;
00032                         break;
00033                 case CMW::Log::Level::LL_INFO:
00034                         severity = LOG_INFO;
00035                         break;
00036                 case CMW::Log::Level::LL_DEBUG:
00037                         severity = LOG_DEBUG;
00038                         break;
00039                 case CMW::Log::Level::LL_TRACE: 
00040                         severity = LOG_NOTICE;
00041                         break;
00042                 default:
00043                         severity = LOG_ERR;
00044                         break;
00045         }
00046 
00047     syslog(facility_ + severity, (char *) msg.toString().c_str());
00048 
00049     //This does a log with using the default-facility
00050         //syslog(severity, (char *) msg.toString().c_str());
00051 }
00052 
00053 }

Generated on 25 Jan 2013 for fesa-core-gsi by  doxygen 1.6.1