[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[or-cvs] removed loglevel from global namespace. severity level is s...



Update of /home/or/cvsroot/src/common
In directory moria.seul.org:/tmp/cvs-serv18515/src/common

Modified Files:
	log.c 
Log Message:
removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);


Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- log.c	26 Jun 2002 22:45:50 -0000	1.1.1.1
+++ log.c	12 Jul 2002 18:14:16 -0000	1.2
@@ -8,6 +8,9 @@
 /*
  * Changes :
  * $Log$
+ * Revision 1.2  2002/07/12 18:14:16  montrose
+ * removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
+ *
  * Revision 1.1.1.1  2002/06/26 22:45:50  arma
  * initial commit: current code
  *
@@ -54,21 +57,25 @@
 #include <errno.h>
 #include "log.h"
 
-void log_internal(int severity, const char *format, va_list ap);
-
 /* Outputs a message to stdout */
 void log(int severity, const char *format, ...)
 {
-  extern int loglevel;
+  static int loglevel = LOG_DEBUG;
   va_list ap;
 
-  va_start(ap,format);
-
-  if (severity <= loglevel)
+  if ( format )
   {
-    vprintf(format,ap);
-    printf("\n");
-  }
+
+    va_start(ap,format);
   
-  va_end(ap);
+    if (severity <= loglevel)
+    {
+      vprintf(format,ap);
+      printf("\n");
+    }
+    
+    va_end(ap);
+  }
+  else
+    loglevel = severity;
 }