Rename a file that had a confusing filename.
[deb_shairplay.git] / src / lib / logger.h
1 #ifndef LOGGER_H
2 #define LOGGER_H
3
4 /* Define syslog style log levels */
5 #define LOGGER_EMERG 0 /* system is unusable */
6 #define LOGGER_ALERT 1 /* action must be taken immediately */
7 #define LOGGER_CRIT 2 /* critical conditions */
8 #define LOGGER_ERR 3 /* error conditions */
9 #define LOGGER_WARNING 4 /* warning conditions */
10 #define LOGGER_NOTICE 5 /* normal but significant condition */
11 #define LOGGER_INFO 6 /* informational */
12 #define LOGGER_DEBUG 7 /* debug-level messages */
13
14 typedef void (*logger_callback_t)(int level, char *msg);
15
16 struct logger_s {
17 int level;
18 logger_callback_t callback;
19 };
20 typedef struct logger_s logger_t;
21
22 void logger_init(logger_t *logger);
23 void logger_set_level(logger_t *logger, int level);
24 void logger_set_callback(logger_t *logger, logger_callback_t callback);
25
26 void logger_log(logger_t *logger, int level, const char *fmt, ...);
27
28 #endif