2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
18 /* Define syslog style log levels */
19 #define LOGGER_EMERG 0 /* system is unusable */
20 #define LOGGER_ALERT 1 /* action must be taken immediately */
21 #define LOGGER_CRIT 2 /* critical conditions */
22 #define LOGGER_ERR 3 /* error conditions */
23 #define LOGGER_WARNING 4 /* warning conditions */
24 #define LOGGER_NOTICE 5 /* normal but significant condition */
25 #define LOGGER_INFO 6 /* informational */
26 #define LOGGER_DEBUG 7 /* debug-level messages */
28 typedef void (*logger_callback_t
)(int level
, char *msg
);
32 logger_callback_t callback
;
34 typedef struct logger_s logger_t
;
36 void logger_init(logger_t
*logger
);
37 void logger_set_level(logger_t
*logger
, int level
);
38 void logger_set_callback(logger_t
*logger
, logger_callback_t callback
);
40 void logger_log(logger_t
*logger
, int level
, const char *fmt
, ...);