Review and cleanup the raop.c a little bit
[deb_shairplay.git] / src / lib / logger.h
CommitLineData
23e7e3ae
JVH
1/**
2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
3 *
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.
8 *
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.
13 */
14
2340bcd3
JVH
15#ifndef LOGGER_H
16#define LOGGER_H
17
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 */
27
28typedef void (*logger_callback_t)(int level, char *msg);
29
30struct logger_s {
31 int level;
32 logger_callback_t callback;
33};
34typedef struct logger_s logger_t;
35
36void logger_init(logger_t *logger);
37void logger_set_level(logger_t *logger, int level);
38void logger_set_callback(logger_t *logger, logger_callback_t callback);
39
40void logger_log(logger_t *logger, int level, const char *fmt, ...);
41
42#endif