ucx/logging.h

Thu, 11 Oct 2012 11:42:31 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 11 Oct 2012 11:42:31 +0200
changeset 67
27e67e725d35
parent 57
e18157c52985
child 69
fb59270b1de3
permissions
-rw-r--r--

added some qualifiers + removed pointer alias in mergesort

olaf@57 1 #ifndef LOGGING_H
olaf@57 2 #define LOGGING_H
olaf@57 3
olaf@57 4 #include "string.h"
olaf@57 5 #include <stdio.h>
olaf@57 6
olaf@57 7 #ifdef __cplusplus
olaf@57 8 extern "C" {
olaf@57 9 #endif
olaf@57 10
olaf@57 11 /* leave enough space for custom log levels */
olaf@57 12 #define UCX_LOGGER_ERROR 0x00
olaf@57 13 #define UCX_LOGGER_WARN 0x10
olaf@57 14 #define UCX_LOGGER_INFO 0x20
olaf@57 15 #define UCX_LOGGER_TRACE 0x30
olaf@57 16
olaf@57 17 typedef struct {
olaf@57 18 FILE *stream;
olaf@57 19 unsigned int level;
olaf@57 20 } UcxLogger;
olaf@57 21
olaf@57 22 UcxLogger *ucx_logger_new(FILE *stream, unsigned int level);
olaf@57 23 /* neither provide a free function nor a parameter for an allocator */
olaf@57 24
universe@67 25 void ucx_logger_log(UcxLogger *logger, unsigned int level,
universe@67 26 const sstr_t message);
olaf@57 27 #define ucx_logger_error(l,m) ucx_logger_log(l, UCX_LOGGER_ERROR, m)
olaf@57 28 #define ucx_logger_info(l,m) ucx_logger_log(l, UCX_LOGGER_INFO, m)
olaf@57 29 #define ucx_logger_warn(l,m) ucx_logger_log(l, UCX_LOGGER_WARN, m)
olaf@57 30 #define ucx_logger_trace(l,m) ucx_logger_log(l, UCX_LOGGER_TRACE, m)
olaf@57 31
olaf@57 32 #ifdef __cplusplus
olaf@57 33 }
olaf@57 34 #endif
olaf@57 35
olaf@57 36 #endif /* LOGGING_H */

mercurial