Add cls pointer to the logger
[deb_shairplay.git] / src / lib / logger.h
index ba8b95f58e2a884934f23c08c7cea2f85aa5628a..9a81358d95908e2de127d7b89e917d24dbfec753 100644 (file)
@@ -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
 
 #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, ...);