ucx/logging.h

changeset 17
11dffb40cd91
parent 5
88625853ae74
child 70
88092b88ec00
--- a/ucx/logging.h	Fri Aug 16 12:41:30 2013 +0200
+++ b/ucx/logging.h	Sat Aug 17 12:04:04 2013 +0200
@@ -44,14 +44,19 @@
 #endif
 
 /* leave enough space for custom log levels */
+
 /** Log level for error messages. */
 #define UCX_LOGGER_ERROR        0x00
+    
 /** Log level for warning messages. */
 #define UCX_LOGGER_WARN         0x10
+
 /** Log level for information messages. */
 #define UCX_LOGGER_INFO         0x20
+
 /** Log level for debug messages. */
 #define UCX_LOGGER_DEBUG        0x30
+
 /** Log level for trace messages. */
 #define UCX_LOGGER_TRACE        0x40
 
@@ -61,12 +66,14 @@
  * @see UcxLogger.mask
  */
 #define UCX_LOGGER_LEVEL        0x01
+
 /**
  * Output flag for the timestmap.
  * If this flag is set, the log message will contain the timestmap.
  * @see UcxLogger.mask
  */
 #define UCX_LOGGER_TIMESTAMP    0x02
+
 /**
  * Output flag for the source.
  * If this flag is set, the log message will contain the source file and line
@@ -81,24 +88,28 @@
 typedef struct {
     /** The stream this logger writes its messages to.*/
     void *stream;
+
     /**
      * The write function that shall be used.
      * For standard file or stdout loggers this might be standard fwrite
      * (default).
      */
     write_func writer;
+
     /**
      * The date format for timestamp outputs
      * (default: <code>"%F %T %z "</code>).
      * @see UCX_LOGGER_TIMESTAMP
      */
     char *dateformat;
+
     /**
      * The level, this logger operates on.
      * If a log command is issued, the message will only be logged, if the log
      * level of the message is less or equal than the log level of the logger.
      */
     unsigned int level;
+
     /**
      * A configuration mask for automatic output. 
      * For each flag that is set, the logger automatically outputs some extra
@@ -106,6 +117,7 @@
      * See the documentation for the flags for details.
      */
     unsigned int mask;
+
     /**
      * A map of valid log levels for this logger.
      * 
@@ -128,6 +140,7 @@
  * @return a new logger object
  */
 UcxLogger *ucx_logger_new(void *stream, unsigned int level, unsigned int mask);
+
 /**
  * Destroys the logger.
  * 
@@ -148,6 +161,9 @@
  * 
  * <code>[LEVEL] [TIMESTAMP] [SOURCEFILE]:[LINENO] message</code>
  * 
+ * <b>Attention:</b> the message (including automatically generated information)
+ * <b>MUST NOT</b> exceed the size of 4 KB.
+ * 
  * @param logger the logger to use
  * @param level the level to log on
  * @param file information about the source file
@@ -177,6 +193,7 @@
  */
 #define ucx_logger_error(logger, ...) \
     ucx_logger_log(logger, UCX_LOGGER_ERROR, __VA_ARGS__)
+
 /**
  * Shortcut for logging an information message.
  * @param logger the logger to use
@@ -185,6 +202,7 @@
  */
 #define ucx_logger_info(logger, ...) \
     ucx_logger_log(logger, UCX_LOGGER_INFO, __VA_ARGS__)
+
 /**
  * Shortcut for logging a warning message.
  * @param logger the logger to use
@@ -193,6 +211,7 @@
  */
 #define ucx_logger_warn(logger, ...) \
     ucx_logger_log(logger, UCX_LOGGER_WARN, __VA_ARGS__)
+
 /**
  * Shortcut for logging a debug message.
  * @param logger the logger to use
@@ -201,6 +220,7 @@
  */
 #define ucx_logger_debug(logger, ...) \
     ucx_logger_log(logger, UCX_LOGGER_DEBUG, __VA_ARGS__)
+
 /**
  * Shortcut for logging a trace message.
  * @param logger the logger to use

mercurial