]> arthur.barton.de Git - ngircd.git/commitdiff
log.c and log.h from CVSHEAD (adds LogDebug() Function)
authorFlorian Westphal <fw@strlen.de>
Wed, 8 Feb 2006 21:23:21 +0000 (21:23 +0000)
committerFlorian Westphal <fw@strlen.de>
Wed, 8 Feb 2006 21:23:21 +0000 (21:23 +0000)
src/ngircd/log.c
src/ngircd/log.h

index ff71acb4c96520183ccbbd0aa5f1b27a0b8a6159..9b588de9d97f8b070dcd3c03203be2be3da18287 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: log.c,v 1.57.2.1 2005/08/29 11:19:48 alex Exp $";
+static char UNUSED id[] = "$Id: log.c,v 1.57.2.2 2006/02/08 21:23:21 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -44,15 +44,15 @@ static char UNUSED id[] = "$Id: log.c,v 1.57.2.1 2005/08/29 11:19:48 alex Exp $"
 #include "log.h"
 
 
-LOCAL char Init_Txt[127];
-LOCAL bool Is_Daemon;
+static char Init_Txt[127];
+static bool Is_Daemon;
 
 #ifdef DEBUG
-LOCAL char Error_File[FNAME_LEN];
+static char Error_File[FNAME_LEN];
 #endif
 
 
-LOCAL void Wall_ServerNotice PARAMS(( char *Msg ));
+static void Wall_ServerNotice PARAMS(( char *Msg ));
 
 
 GLOBAL void
@@ -162,6 +162,35 @@ Log_Exit( void )
 } /* Log_Exit */
 
 
+# ifdef PROTOTYPES
+GLOBAL void
+LogDebug( const char *Format, ... )
+# else
+GLOBAL void
+LogDebug( Format, va_alist )
+const char *Format;
+va_dcl
+# endif
+#ifdef DEBUG
+{
+       char msg[MAX_LOG_MSG_LEN];
+       va_list ap;
+
+       if (!NGIRCd_Debug) return;
+#ifdef PROTOTYPES
+       va_start( ap, Format );
+#else
+       va_start( ap );
+#endif
+       vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
+       va_end( ap );
+       Log(LOG_DEBUG, "%s", msg);
+}
+#else
+{ /* do nothing */ }
+#endif /* DEBUG */
+
+       
 #ifdef PROTOTYPES
 GLOBAL void
 Log( int Level, const char *Format, ... )
@@ -174,7 +203,6 @@ va_dcl
 #endif
 {
        /* Eintrag in Logfile(s) schreiben */
-
        char msg[MAX_LOG_MSG_LEN];
        bool snotice;
        va_list ap;
@@ -306,7 +334,7 @@ va_dcl
  * Send log messages to users flagged with the "s" mode.
  * @param Msg The message to send.
  */
-LOCAL void
+static void
 Wall_ServerNotice( char *Msg )
 {
        CLIENT *c;
index a49375f4f51c089678424af3a26d94885cd92168..bdd322f36f0991da7626dc1556fa1b2492b88dbc 100644 (file)
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: log.h,v 1.18 2005/06/24 19:55:10 alex Exp $
+ * $Id: log.h,v 1.18.2.1 2006/02/08 21:23:21 fw Exp $
  *
  * Logging functions (header)
  */
@@ -39,6 +39,7 @@ GLOBAL void Log_Init PARAMS(( bool Daemon_Mode ));
 GLOBAL void Log_Exit PARAMS(( void ));
 
 GLOBAL void Log PARAMS(( int Level, const char *Format, ... ));
+GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
 
 GLOBAL void Log_Init_Resolver PARAMS(( void ));
 GLOBAL void Log_Exit_Resolver PARAMS(( void ));