taskrambler  0.1.8
Web server and task management solution.
syslog.c
Go to the documentation of this file.
1 /**
2  * \file
3  *
4  * \author Georg Hopp
5  *
6  * \copyright
7  * Copyright © 2012 Georg Hopp
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include <syslog.h>
24 
25 #include "logger/logger.h"
27 
28 static
29 const
30 int syslog_priority[] = {
31  LOG_USER | LOG_DEBUG,
32  LOG_USER | LOG_INFO,
33  LOG_USER | LOG_NOTICE,
34  LOG_USER | LOG_WARNING,
35  LOG_USER | LOG_ERR,
36  LOG_USER | LOG_CRIT,
37  LOG_USER | LOG_ALERT,
38  LOG_USER | LOG_EMERG
39 };
40 
41 static
42 void
43 logSyslog(void * this, logger_level level, const char * const msg)
44 {
45  syslog(syslog_priority[level], "[%s] %s", logger_level_str[level], msg);
46 }
47 
48 INIT_IFACE(Logger, logSyslog);
49 CREATE_CLASS(LoggerSyslog, Logger, IFACE(Logger));
50 
51 // vim: set ts=4 sw=4:
const char *const logger_level_str[]
Definition: logger.c:31
logger_level
Definition: logger/logger.h:30
static void logSyslog(void *this, logger_level level, const char *const msg)
Definition: syslog.c:43
#define IFACE(name)
Definition: interface.h:34
INIT_IFACE(Logger, logSyslog)
CREATE_CLASS(LoggerSyslog, Logger, IFACE(Logger))
static const int syslog_priority[]
Definition: syslog.c:30