Mercurial > noffle
diff src/log.c @ 185:fed1334d766b noffle
[svn] * src/client.c: Change variable only used on constant to 'const'.
* src/filter.c: Add a couple of 'return's after ASSERT() to remove
compiler warnings about functions needing returns.
* NEWS,TODO,configure,configure.in,noffle.conf.example,docs/NOTES,
docs/noffle.conf.5,src/client.c,src/configfile.c,src/content.c,
src/control.c,src/database.c,src/fetch.c,src/fetchlist.c,src/filter.c,
src/group.c,src/lock.c,src/log.c,src/log.h,src/noffle.c,src/outgoing.c,
src/post.c,src/protocol.c,src/request.c,src/server.c,src/util.c:
Debug logging is always compiled and selected via noffle.conf. All debug
logs are classified as all, none, config, control, expire, fetch,
filter, newsbase, noffle, post, protocol, requests and server.
author | bears |
---|---|
date | Sun, 05 Aug 2001 09:24:22 +0100 |
parents | c874bd3c4bb8 |
children | 755e03bc7dcf |
line wrap: on
line diff
--- a/src/log.c Tue Jun 19 11:23:43 2001 +0100 +++ b/src/log.c Sun Aug 05 09:24:22 2001 +0100 @@ -1,7 +1,7 @@ /* log.c - $Id: log.c 79 2000-05-13 15:35:17Z bears $ + $Id: log.c 300 2001-08-05 08:24:22Z bears $ */ #if HAVE_CONFIG_H @@ -16,10 +16,13 @@ #define MAXLENGTH 240 +#define DEFAULT_DBG_MASK LOG_DBG_NONE + struct { Bool interactive; -} log = { FALSE }; + unsigned debugMask; +} log = { FALSE, DEFAULT_DBG_MASK }; void Log_init( const char *name, Bool interactive, int facility ) @@ -73,9 +76,19 @@ } void -Log_dbg( const char *fmt, ... ) +Log_dbg( unsigned subsystem, const char *fmt, ... ) { -#ifdef DEBUG - DO_LOG( LOG_DEBUG ); -#endif + if ( ( subsystem & log.debugMask ) != 0 ) { + DO_LOG( LOG_DEBUG ); + } } + +void +Log_setDbgMask( unsigned mask ) +{ + /* A non-zero mask always include Noffle logs */ + if ( mask != 0 ) + mask |= LOG_DBG_NOFFLE; + + log.debugMask = mask; +}