From 2ce5075773f3f60ef78ab8191ace071f7a4e4d66 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 14 Feb 2009 00:16:42 +0100 Subject: [PATCH] Logging: Improved documentation of struct log_stream. --- ucw/log.h | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/ucw/log.h b/ucw/log.h index dcef4ae9..1a3bdf50 100644 --- a/ucw/log.h +++ b/ucw/log.h @@ -20,8 +20,8 @@ struct log_msg { char *m; // The formatted message itself, ending with \n\0 int m_len; // Length without the \0 - struct tm *tm; - uns flags; + struct tm *tm; // Current time + uns flags; // Category and other flags as passed to msg() char *raw_msg; // Unformatted parts char *stime; char *sutime; @@ -29,26 +29,17 @@ struct log_msg struct log_stream { - /* optional name, 0-term, de/allocated by constr./destr. or user */ - char *name; - /* number for use with msg parameter (from LS_SET_STRNUM()), -1 for closed log_stream */ - int regnum; - /* arbitrary data for filter/handler */ - int idata; + char *name; // Optional name, allocated by the user (or constructor) + int regnum; // Stream number, already encoded by LS_SET_STRNUM(); -1 if closed + uns levels; // Bitmask of accepted severity levels + uns msgfmt; // Formatting flags (LSFMT_xxx) + int (*filter)(struct log_stream* ls, struct log_msg *m); // Filter function, return non-zero to discard the message + struct clist substreams; // Pass the message to these streams (simple_list of pointers) + int (*handler)(struct log_stream *ls, struct log_msg *m); // Called to commit the message + void (*close)(struct log_stream* ls); // Called on log_close_stream() + int idata; // Private data of the handler void *pdata; uns udata; - /* severity levels to accept - bitmask of (1<