1.1 --- a/ucx/logging.h Wed Aug 14 16:07:49 2013 +0200 1.2 +++ b/ucx/logging.h Fri Aug 16 13:40:10 2013 +0200 1.3 @@ -44,14 +44,19 @@ 1.4 #endif 1.5 1.6 /* leave enough space for custom log levels */ 1.7 + 1.8 /** Log level for error messages. */ 1.9 #define UCX_LOGGER_ERROR 0x00 1.10 + 1.11 /** Log level for warning messages. */ 1.12 #define UCX_LOGGER_WARN 0x10 1.13 + 1.14 /** Log level for information messages. */ 1.15 #define UCX_LOGGER_INFO 0x20 1.16 + 1.17 /** Log level for debug messages. */ 1.18 #define UCX_LOGGER_DEBUG 0x30 1.19 + 1.20 /** Log level for trace messages. */ 1.21 #define UCX_LOGGER_TRACE 0x40 1.22 1.23 @@ -61,12 +66,14 @@ 1.24 * @see UcxLogger.mask 1.25 */ 1.26 #define UCX_LOGGER_LEVEL 0x01 1.27 + 1.28 /** 1.29 * Output flag for the timestmap. 1.30 * If this flag is set, the log message will contain the timestmap. 1.31 * @see UcxLogger.mask 1.32 */ 1.33 #define UCX_LOGGER_TIMESTAMP 0x02 1.34 + 1.35 /** 1.36 * Output flag for the source. 1.37 * If this flag is set, the log message will contain the source file and line 1.38 @@ -81,24 +88,28 @@ 1.39 typedef struct { 1.40 /** The stream this logger writes its messages to.*/ 1.41 void *stream; 1.42 + 1.43 /** 1.44 * The write function that shall be used. 1.45 * For standard file or stdout loggers this might be standard fwrite 1.46 * (default). 1.47 */ 1.48 write_func writer; 1.49 + 1.50 /** 1.51 * The date format for timestamp outputs 1.52 * (default: <code>"%F %T %z "</code>). 1.53 * @see UCX_LOGGER_TIMESTAMP 1.54 */ 1.55 char *dateformat; 1.56 + 1.57 /** 1.58 * The level, this logger operates on. 1.59 * If a log command is issued, the message will only be logged, if the log 1.60 * level of the message is less or equal than the log level of the logger. 1.61 */ 1.62 unsigned int level; 1.63 + 1.64 /** 1.65 * A configuration mask for automatic output. 1.66 * For each flag that is set, the logger automatically outputs some extra 1.67 @@ -106,6 +117,7 @@ 1.68 * See the documentation for the flags for details. 1.69 */ 1.70 unsigned int mask; 1.71 + 1.72 /** 1.73 * A map of valid log levels for this logger. 1.74 * 1.75 @@ -128,6 +140,7 @@ 1.76 * @return a new logger object 1.77 */ 1.78 UcxLogger *ucx_logger_new(void *stream, unsigned int level, unsigned int mask); 1.79 + 1.80 /** 1.81 * Destroys the logger. 1.82 * 1.83 @@ -180,6 +193,7 @@ 1.84 */ 1.85 #define ucx_logger_error(logger, ...) \ 1.86 ucx_logger_log(logger, UCX_LOGGER_ERROR, __VA_ARGS__) 1.87 + 1.88 /** 1.89 * Shortcut for logging an information message. 1.90 * @param logger the logger to use 1.91 @@ -188,6 +202,7 @@ 1.92 */ 1.93 #define ucx_logger_info(logger, ...) \ 1.94 ucx_logger_log(logger, UCX_LOGGER_INFO, __VA_ARGS__) 1.95 + 1.96 /** 1.97 * Shortcut for logging a warning message. 1.98 * @param logger the logger to use 1.99 @@ -196,6 +211,7 @@ 1.100 */ 1.101 #define ucx_logger_warn(logger, ...) \ 1.102 ucx_logger_log(logger, UCX_LOGGER_WARN, __VA_ARGS__) 1.103 + 1.104 /** 1.105 * Shortcut for logging a debug message. 1.106 * @param logger the logger to use 1.107 @@ -204,6 +220,7 @@ 1.108 */ 1.109 #define ucx_logger_debug(logger, ...) \ 1.110 ucx_logger_log(logger, UCX_LOGGER_DEBUG, __VA_ARGS__) 1.111 + 1.112 /** 1.113 * Shortcut for logging a trace message. 1.114 * @param logger the logger to use