20 #include "SysLogHandler.hpp"
38 m_pIdentity(pIdentity),
52 ::setlogmask(LOG_UPTO(LOG_DEBUG));
53 ::openlog(m_pIdentity, LOG_PID|LOG_CONS|LOG_ODELAY, m_facility);
76 m_pCategory = pCategory;
80 case Logger::LL_ALERT:
81 m_severity = LOG_ALERT;
83 case Logger::LL_CRITICAL:
84 m_severity = LOG_CRIT;
86 case Logger::LL_ERROR:
89 case Logger::LL_WARNING:
90 m_severity = LOG_WARNING;
95 case Logger::LL_DEBUG:
96 m_severity = LOG_DEBUG;
108 ::syslog(m_facility | m_severity,
"[%s] %s", m_pCategory, pMsg);
120 if(param ==
"facility") {
121 return setFacility(value);
126 static const struct syslog_facility {
129 } facilitynames[] = {
130 {
"auth", LOG_AUTH },
132 {
"authpriv", LOG_AUTHPRIV },
134 {
"cron", LOG_CRON },
135 {
"daemon", LOG_DAEMON },
139 {
"kern", LOG_KERN },
141 {
"mail", LOG_MAIL },
142 {
"news", LOG_NEWS },
143 {
"syslog", LOG_SYSLOG },
144 {
"user", LOG_USER },
145 {
"uucp", LOG_UUCP },
146 {
"local0", LOG_LOCAL0 },
147 {
"local1", LOG_LOCAL1 },
148 {
"local2", LOG_LOCAL2 },
149 {
"local3", LOG_LOCAL3 },
150 {
"local4", LOG_LOCAL4 },
151 {
"local5", LOG_LOCAL5 },
152 {
"local6", LOG_LOCAL6 },
153 {
"local7", LOG_LOCAL7 },
158 SysLogHandler::setFacility(
const BaseString &facility) {
159 const struct syslog_facility *c;
160 for(c = facilitynames; c->name != NULL; c++) {
161 if(facility == c->name) {
162 m_facility = c->value;