diff src/client.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 c912e8288164
children 166008a80f03
line wrap: on
line diff
--- a/src/client.c	Tue Jun 19 11:23:43 2001 +0100
+++ b/src/client.c	Sun Aug 05 09:24:22 2001 +0100
@@ -1,7 +1,7 @@
 /*
   client.c
 
-  $Id: client.c 292 2001-05-15 12:07:53Z bears $
+  $Id: client.c 300 2001-08-05 08:24:22Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -109,7 +109,7 @@
 {
     Prt_putTxtBuf( buf, client.out );
     fflush( client.out );
-    Log_dbg( "[S FLUSH]" );
+    Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" );
 }
 
 static void
@@ -117,7 +117,7 @@
 {
     Prt_putEndOfTxt( client.out );
     fflush( client.out );
-    Log_dbg( "[S FLUSH]" );
+    Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" );
 }
 
 static Bool
@@ -128,7 +128,7 @@
 
     strcpy( client.lastCmd, line );
     strcpy( client.lastStat, "[no status available]" );
-    Log_dbg( "[S] %s", line );
+    Log_dbg( LOG_DBG_PROTOCOL, "[S] %s", line );
     n = fprintf( client.out, "%s\r\n", line );
     err = ( n != strlen( line ) + 2 );
     if ( err )
@@ -148,7 +148,7 @@
     if ( ! putCmdLn( line ) )
         return FALSE;
     fflush( client.out );
-    Log_dbg( "[S FLUSH]" );
+    Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" );
     return TRUE;
 }
 
@@ -486,7 +486,8 @@
 		groupupdate = TRUE;
             }
             else
-                Log_dbg( "Group %s is already fetched from %s",
+                Log_dbg( LOG_DBG_FETCH,
+			 "Group %s is already fetched from %s",
 			 grp, Grp_server( grp ) );            
         }
     }
@@ -647,7 +648,7 @@
         strcpy( dsc, Utl_restOfLn( line, 1 ) );
         if ( Grp_exists( name ) )
         {
-            Log_dbg( "Description of %s: %s", name, dsc );
+            Log_dbg( LOG_DBG_FETCH, "Description of %s: %s", name, dsc );
             Grp_setDsc( name, dsc );
         }
     }
@@ -804,7 +805,9 @@
         return NULL;
     }
     Utl_cpyStrN( grp, s, pColon - s );
-    Log_dbg( "client.c: nextXref: grp '%s' numb %lu", grp, numb );
+    Log_dbg( LOG_DBG_FETCH,
+	     "client.c: nextXref: grp '%s' numb %lu",
+	     grp, numb );
     return src;
 }
 
@@ -815,18 +818,18 @@
     const char *msgId;
     int status;
     time_t lastAccess, nowTime;
-    double threadFollowTime, secPerDay, maxTime, timeSinceLastAccess;
+    double threadFollowTime, maxTime, timeSinceLastAccess;
     ItemList *itl;
+    const double secPerDay = 24.0 * 3600.0;
 
     ASSERT( Lock_gotLock() );
-    Log_dbg( "Checking references '%s' for thread mode", ref );
+    Log_dbg( LOG_DBG_FETCH, "Checking references '%s' for thread mode", ref );
     result = FALSE;
     itl = new_Itl( ref, " \t" );
     nowTime = time( NULL );
     threadFollowTime = (double)Cfg_threadFollowTime();
-    secPerDay = 24.0 * 3600.0;
     maxTime = threadFollowTime * secPerDay;
-    Log_dbg( "Max time = %.0f", maxTime );
+    Log_dbg( LOG_DBG_FETCH, "Max time = %.0f", maxTime );
     for ( msgId = Itl_first( itl ); msgId != NULL; msgId = Itl_next( itl ) )
     {
         /*
@@ -839,7 +842,8 @@
             lastAccess = Db_lastAccess( msgId );
             interesting = ( status & DB_INTERESTING );
             timeSinceLastAccess = difftime( nowTime, lastAccess );
-            Log_dbg( "Msg ID '%s': since last access = %.0f, interesting = %s",
+            Log_dbg( LOG_DBG_FETCH,
+		     "Msg ID '%s': since last access = %.0f, interesting = %s",
                      msgId, timeSinceLastAccess, ( interesting ? "y" : "n" ) );
             if ( interesting && timeSinceLastAccess <= maxTime )
             {
@@ -849,11 +853,12 @@
         }
         else
         {
-            Log_dbg( "MsgID '%s': not in database.", msgId );
+            Log_dbg( LOG_DBG_FETCH, "MsgID '%s': not in database.", msgId );
         }
     }
     del_Itl( itl );
-    Log_dbg( "Article %s marking for download.",
+    Log_dbg( LOG_DBG_FETCH,
+	     "Article %s marking for download.",
              ( result ? "needs" : "doesn't need" ) );
     return result;
 }
@@ -868,11 +873,13 @@
     ASSERT( Lock_gotLock() );
     msgId = Ov_msgId( ov );
     if ( Pseudo_isGeneralInfo( msgId ) )
-        Log_dbg( "Skipping general info '%s'", msgId );
+        Log_dbg( LOG_DBG_FETCH, "Skipping general info '%s'", msgId );
     else if ( Db_contains( msgId ) )
     {
         xref = Db_xref( msgId );
-        Log_dbg( "Entry '%s' already in db with Xref '%s'", msgId, xref );
+        Log_dbg( LOG_DBG_FETCH,
+		 "Entry '%s' already in db with Xref '%s'",
+		 msgId, xref );
         p = nextXref( xref, g, &n );
         if ( p == NULL )
             Log_err( "Overview with no group in Xref '%s'", msgId );
@@ -881,7 +888,8 @@
             /* TODO: This code block seems unnessesary. Can we remove it? */
             if ( Cfg_servIsPreferential( client.serv, Grp_server( g ) ) )
             {
-                Log_dbg( "Changing first server for '%s' from '%s' to '%s'",
+                Log_dbg( LOG_DBG_FETCH,
+			 "Changing first server for '%s' from '%s' to '%s'",
                          msgId, Grp_server( g ), client.serv );
                 snprintf( t, MAXCHAR, "%s:%d %s",
                           client.grp, Ov_numb( ov ), xref );
@@ -889,7 +897,8 @@
             }
             else
             {
-                Log_dbg( "Adding '%s' to Xref of '%s'", g, msgId );
+                Log_dbg( LOG_DBG_FETCH,
+			 "Adding '%s' to Xref of '%s'", g, msgId );
                 snprintf( t, MAXCHAR, "%s %s:%d",
                           xref, client.grp, Ov_numb( ov ) );
                 Db_setXref( msgId, t );
@@ -898,7 +907,7 @@
     }
     else
     {
-        Log_dbg( "Preparing '%s' in database", msgId );
+        Log_dbg( LOG_DBG_FETCH, "Preparing '%s' in database", msgId );
         Db_prepareEntry( ov, client.grp, Ov_numb( ov ) );
     }
 }
@@ -929,7 +938,8 @@
 	    return FALSE;
 	}
 
-	Log_dbg( "Requesting Newsgroups headers for remote %lu-%lu",
+	Log_dbg( LOG_DBG_FETCH,
+		 "Requesting Newsgroups headers for remote %lu-%lu",
 		 rmtFirst, rmtLast );
 
 	newsgroups = collectTxt();
@@ -956,7 +966,9 @@
         Log_err( "XOVER command failed: %s", client.lastStat );
         return FALSE;
     }
-    Log_dbg( "Requesting overview for remote %lu-%lu", rmtFirst, rmtLast );
+    Log_dbg( LOG_DBG_FETCH,
+	     "Requesting overview for remote %lu-%lu",
+	     rmtFirst, rmtLast );
 
     response = collectTxt();
     if ( response == NULL )
@@ -1147,7 +1159,7 @@
 
     Lock_closeDatabases();
     fflush( client.out );
-    Log_dbg( "[S FLUSH]" );
+    Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" );
     
     p = DynStr_str( s );
     res = TRUE;