ucx/logging.h

changeset 57
e18157c52985
parent 54
f634f790661a
child 67
27e67e725d35
     1.1 --- a/ucx/logging.h	Tue Oct 09 15:02:40 2012 +0200
     1.2 +++ b/ucx/logging.h	Tue Oct 09 16:46:29 2012 +0200
     1.3 @@ -1,35 +1,35 @@
     1.4 -#ifndef LOGGING_H
     1.5 -#define LOGGING_H
     1.6 -
     1.7 -#include "string.h"
     1.8 -#include <stdio.h>
     1.9 -
    1.10 -#ifdef __cplusplus
    1.11 -extern "C" {
    1.12 -#endif
    1.13 -
    1.14 -/* leave enough space for custom log levels */
    1.15 -#define UCX_LOGGER_ERROR    0x00
    1.16 -#define UCX_LOGGER_WARN     0x10
    1.17 -#define UCX_LOGGER_INFO     0x20
    1.18 -#define UCX_LOGGER_TRACE    0x30
    1.19 -
    1.20 -typedef struct {
    1.21 -    FILE *stream;
    1.22 -    unsigned int level;
    1.23 -} UcxLogger;
    1.24 -
    1.25 -UcxLogger *ucx_logger_new(FILE *stream, unsigned int level);
    1.26 -/* neither provide a free function nor a parameter for an allocator */
    1.27 -
    1.28 -void ucx_logger_log(UcxLogger *logger, unsigned int level, sstr_t message);
    1.29 -#define ucx_logger_error(l,m) ucx_logger_log(l, UCX_LOGGER_ERROR, m)
    1.30 -#define ucx_logger_info(l,m) ucx_logger_log(l, UCX_LOGGER_INFO, m)
    1.31 -#define ucx_logger_warn(l,m) ucx_logger_log(l, UCX_LOGGER_WARN, m)
    1.32 -#define ucx_logger_trace(l,m) ucx_logger_log(l, UCX_LOGGER_TRACE, m)
    1.33 -
    1.34 -#ifdef __cplusplus
    1.35 -}
    1.36 -#endif
    1.37 -
    1.38 -#endif /* LOGGING_H */
    1.39 +#ifndef LOGGING_H
    1.40 +#define LOGGING_H
    1.41 +
    1.42 +#include "string.h"
    1.43 +#include <stdio.h>
    1.44 +
    1.45 +#ifdef __cplusplus
    1.46 +extern "C" {
    1.47 +#endif
    1.48 +
    1.49 +/* leave enough space for custom log levels */
    1.50 +#define UCX_LOGGER_ERROR    0x00
    1.51 +#define UCX_LOGGER_WARN     0x10
    1.52 +#define UCX_LOGGER_INFO     0x20
    1.53 +#define UCX_LOGGER_TRACE    0x30
    1.54 +
    1.55 +typedef struct {
    1.56 +    FILE *stream;
    1.57 +    unsigned int level;
    1.58 +} UcxLogger;
    1.59 +
    1.60 +UcxLogger *ucx_logger_new(FILE *stream, unsigned int level);
    1.61 +/* neither provide a free function nor a parameter for an allocator */
    1.62 +
    1.63 +void ucx_logger_log(UcxLogger *logger, unsigned int level, sstr_t message);
    1.64 +#define ucx_logger_error(l,m) ucx_logger_log(l, UCX_LOGGER_ERROR, m)
    1.65 +#define ucx_logger_info(l,m) ucx_logger_log(l, UCX_LOGGER_INFO, m)
    1.66 +#define ucx_logger_warn(l,m) ucx_logger_log(l, UCX_LOGGER_WARN, m)
    1.67 +#define ucx_logger_trace(l,m) ucx_logger_log(l, UCX_LOGGER_TRACE, m)
    1.68 +
    1.69 +#ifdef __cplusplus
    1.70 +}
    1.71 +#endif
    1.72 +
    1.73 +#endif /* LOGGING_H */

mercurial