X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Flogger.h;h=9a81358d95908e2de127d7b89e917d24dbfec753;hb=2975b4b88d0103dcc1ac84202bcfc221671e6743;hp=ba8b95f58e2a884934f23c08c7cea2f85aa5628a;hpb=1b4a582b04fc39d9d4d930acb4d0803bdedfb32e;p=deb_shairplay.git diff --git a/src/lib/logger.h b/src/lib/logger.h index ba8b95f..9a81358 100644 --- a/src/lib/logger.h +++ b/src/lib/logger.h @@ -1,3 +1,17 @@ +/** + * Copyright (C) 2011-2012 Juho Vähä-Herttua + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + */ + #ifndef LOGGER_H #define LOGGER_H @@ -11,17 +25,15 @@ #define LOGGER_INFO 6 /* informational */ #define LOGGER_DEBUG 7 /* debug-level messages */ -typedef void (*logger_callback_t)(int level, char *msg); +typedef void (*logger_callback_t)(void *cls, int level, const char *msg); -struct logger_s { - int level; - logger_callback_t callback; -}; typedef struct logger_s logger_t; -void logger_init(logger_t *logger); +logger_t *logger_init(); +void logger_destroy(logger_t *logger); + void logger_set_level(logger_t *logger, int level); -void logger_set_callback(logger_t *logger, logger_callback_t callback); +void logger_set_callback(logger_t *logger, logger_callback_t callback, void *cls); void logger_log(logger_t *logger, int level, const char *fmt, ...);