49 #define UCX_LOGGER_ERROR 0x00 52 #define UCX_LOGGER_WARN 0x10 55 #define UCX_LOGGER_INFO 0x20 58 #define UCX_LOGGER_DEBUG 0x30 61 #define UCX_LOGGER_TRACE 0x40 68 #define UCX_LOGGER_LEVEL 0x01 75 #define UCX_LOGGER_TIMESTAMP 0x02 83 #define UCX_LOGGER_SOURCE 0x04 177 const unsigned int line,
const char* format, ...);
185 #define ucx_logger_register_level(logger, level, name) {\ 188 ucx_map_int_put(logger->levels, l, (void*) "[" name "]"); \ 198 #define ucx_logger_log(logger, level, ...) \ 199 ucx_logger_logf(logger, level, __FILE__, __LINE__, __VA_ARGS__) 207 #define ucx_logger_error(logger, ...) \ 208 ucx_logger_log(logger, UCX_LOGGER_ERROR, __VA_ARGS__) 216 #define ucx_logger_info(logger, ...) \ 217 ucx_logger_log(logger, UCX_LOGGER_INFO, __VA_ARGS__) 225 #define ucx_logger_warn(logger, ...) \ 226 ucx_logger_log(logger, UCX_LOGGER_WARN, __VA_ARGS__) 234 #define ucx_logger_debug(logger, ...) \ 235 ucx_logger_log(logger, UCX_LOGGER_DEBUG, __VA_ARGS__) 243 #define ucx_logger_trace(logger, ...) \ 244 ucx_logger_log(logger, UCX_LOGGER_TRACE, __VA_ARGS__) write_func writer
The write function that shall be used.
Definition: logging.h:97
Bounded string implementation.
Main UCX Header providing most common definitions.
The UCX Logger object.
Definition: logging.h:88
char * dateformat
The date format for timestamp outputs including the delimiter (default: "%F %T %z ")...
Definition: logging.h:104
unsigned int mask
A configuration mask for automatic output.
Definition: logging.h:119
UcxLogger * ucx_logger_new(void *stream, unsigned int level, unsigned int mask)
Creates a new logger.
Definition: logging.c:36
void * stream
The stream this logger writes its messages to.
Definition: logging.h:90
Structure for the UCX map.
Definition: map.h:81
size_t(* write_func)(const void *, size_t, size_t, void *)
Function pointer to a write function.
Definition: ucx.h:119
UcxMap * levels
A map of valid log levels for this logger.
Definition: logging.h:132
unsigned int level
The level, this logger operates on.
Definition: logging.h:111
void ucx_logger_logf(UcxLogger *logger, unsigned int level, const char *file, const unsigned int line, const char *format,...)
Internal log function - use macros instead.
Definition: logging.c:70
void ucx_logger_free(UcxLogger *logger)
Destroys the logger.
Definition: logging.c:62