Thu, 17 Jan 2013 23:56:48 +0100
used more library friendly optimization level
#ifndef LOGGING_H #define LOGGING_H #include "ucx.h" #include "string.h" #include <stdio.h> #ifdef __cplusplus extern "C" { #endif /* leave enough space for custom log levels */ #define UCX_LOGGER_ERROR 0x00 #define UCX_LOGGER_WARN 0x10 #define UCX_LOGGER_INFO 0x20 #define UCX_LOGGER_TRACE 0x30 typedef struct { FILE *stream; unsigned int level; } UcxLogger; UcxLogger *ucx_logger_new(FILE *stream, unsigned int level); /* neither provide a free function nor a parameter for an allocator */ void ucx_logger_log(UcxLogger *logger, unsigned int level, const sstr_t message); #define ucx_logger_error(l,m) ucx_logger_log(l, UCX_LOGGER_ERROR, m) #define ucx_logger_info(l,m) ucx_logger_log(l, UCX_LOGGER_INFO, m) #define ucx_logger_warn(l,m) ucx_logger_log(l, UCX_LOGGER_WARN, m) #define ucx_logger_trace(l,m) ucx_logger_log(l, UCX_LOGGER_TRACE, m) #ifdef __cplusplus } #endif #endif /* LOGGING_H */