Fri, 12 Oct 2012 10:54:55 +0200
made the code work with VC++ compiler (use make CONF=windows)
1 #ifndef LOGGING_H
2 #define LOGGING_H
4 #include "ucx.h"
5 #include "string.h"
6 #include <stdio.h>
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
12 /* leave enough space for custom log levels */
13 #define UCX_LOGGER_ERROR 0x00
14 #define UCX_LOGGER_WARN 0x10
15 #define UCX_LOGGER_INFO 0x20
16 #define UCX_LOGGER_TRACE 0x30
18 typedef struct {
19 FILE *stream;
20 unsigned int level;
21 } UcxLogger;
23 UcxLogger *ucx_logger_new(FILE *stream, unsigned int level);
24 /* neither provide a free function nor a parameter for an allocator */
26 void ucx_logger_log(UcxLogger *logger, unsigned int level,
27 const sstr_t message);
28 #define ucx_logger_error(l,m) ucx_logger_log(l, UCX_LOGGER_ERROR, m)
29 #define ucx_logger_info(l,m) ucx_logger_log(l, UCX_LOGGER_INFO, m)
30 #define ucx_logger_warn(l,m) ucx_logger_log(l, UCX_LOGGER_WARN, m)
31 #define ucx_logger_trace(l,m) ucx_logger_log(l, UCX_LOGGER_TRACE, m)
33 #ifdef __cplusplus
34 }
35 #endif
37 #endif /* LOGGING_H */