Mercurial > noffle
diff src/configfile.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 | 1c7303c71f66 |
children | 47569cf4ad4a |
line wrap: on
line diff
--- a/src/configfile.c Tue Jun 19 11:23:43 2001 +0100 +++ b/src/configfile.c Sun Aug 05 09:24:22 2001 +0100 @@ -6,7 +6,7 @@ SPOOLDIR VERSION - $Id: configfile.c 227 2000-10-26 21:21:13Z bears $ + $Id: configfile.c 300 2001-08-05 08:24:22Z bears $ */ #if HAVE_CONFIG_H @@ -225,7 +225,9 @@ if ( Wld_match( grp, config.expire[ i ].pattern ) ) { res = config.expire[ i ].days; - Log_dbg( "Custom expire period %d for group %s", res, grp ); + Log_dbg( LOG_DBG_CONFIG, + "Custom expire period %d for group %s", + res, grp ); return res; } @@ -242,7 +244,9 @@ if ( Wld_match( grp, config.autoSubscribeMode[ i ].pattern ) ) { res = config.autoSubscribeMode[ i ].mode; - Log_dbg( "Custom auto subscribe mode %s for group %s", res, grp ); + Log_dbg( LOG_DBG_CONFIG, + "Custom auto subscribe mode %s for group %s", + res, grp ); return res; } @@ -510,6 +514,65 @@ del_Itl( patterns) ; } +static void +getDebugMask( char *line ) +{ + const char *name; + ItemList *maskNames; + const char *maskName; + unsigned mask; + + name = line; + /* Skip over name and terminate it */ + while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) ) + line++; + if ( line[ 0 ] == '\0' ) + { + logSyntaxErr( name ); + return; + } + line[ 0 ] = '\0'; + line++; + + mask = LOG_DBG_NONE; + maskNames = new_Itl( line, " ," ); + for( maskName = Itl_first( maskNames ); + maskName != NULL; + maskName = Itl_next( maskNames ) ) + { + if ( strcmp( maskName, "all" ) == 0 ) + mask = LOG_DBG_ALL; + else if ( strcmp( maskName, "none" ) == 0 ) + mask = LOG_DBG_NONE; + else if ( strcmp( maskName, "config" ) == 0 ) + mask |= LOG_DBG_CONFIG; + else if ( strcmp( maskName, "control" ) == 0 ) + mask |= LOG_DBG_CONTROL; + else if ( strcmp( maskName, "expire" ) == 0 ) + mask |= LOG_DBG_EXPIRE; + else if ( strcmp( maskName, "fetch" ) == 0 ) + mask |= LOG_DBG_FETCH; + else if ( strcmp( maskName, "filter" ) == 0 ) + mask |= LOG_DBG_FILTER; + else if ( strcmp( maskName, "newsbase" ) == 0 ) + mask |= LOG_DBG_NEWSBASE; + else if ( strcmp( maskName, "noffle" ) == 0 ) + mask |= LOG_DBG_NOFFLE; + else if ( strcmp( maskName, "post" ) == 0 ) + mask |= LOG_DBG_POST; + else if ( strcmp( maskName, "protocol" ) == 0 ) + mask |= LOG_DBG_PROTOCOL; + else if ( strcmp( maskName, "requests" ) == 0 ) + mask |= LOG_DBG_REQUESTS; + else if ( strcmp( maskName, "server" ) == 0 ) + mask |= LOG_DBG_SERVER; + else + logSyntaxErr( line ); + } + del_Itl( maskNames) ; + Log_setDbgMask( mask ); +} + static Bool isValidAutoSubscribeMode( const char *mode ) { @@ -745,12 +808,14 @@ if ( strcmp( ruleName, "action" ) != 0 ) { - Log_dbg( "Adding rule type %d value %s", rule.type, value ); + Log_dbg( LOG_DBG_CONFIG, + "Adding rule type %d value %s", + rule.type, value ); Flt_addRule( f, rule ); } } - Log_dbg( "Adding filter, action %d", f->action ); + Log_dbg( LOG_DBG_CONFIG, "Adding filter, action %d", f->action ); Flt_addFilter( f ); return; @@ -820,6 +885,8 @@ getExpire( p ); else if ( strcmp( "auto-subscribe-mode", name ) == 0 ) getAutoSubscribeMode( p ); + else if ( strcmp( "log-debug", name ) == 0 ) + getDebugMask( p ); else if ( strcmp( "getgroups", name ) == 0 ) getGroups( p, TRUE ); else if ( strcmp( "omitgroups", name ) == 0 )