[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvas-cvs
Subject:    [Openvas-commits] r5328 - in trunk/openvas-libraries: . misc
From:       scm-commit () wald ! intevation ! org
Date:       2009-09-30 10:58:01
Message-ID: 20090930105801.454E785D9F55 () pyrosoma ! intevation ! org
[Download RAW message or body]

Author: mattm
Date: 2009-09-30 12:58:00 +0200 (Wed, 30 Sep 2009)
New Revision: 5328

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/misc/openvas_logging.c
Log:
	* nasl/openvas_logging.c (openvas_logging_t, load_log_configuration)
	(free_log_configuration): Change the default_level field to a gint
	pointer, so that it's possible to reliably tell if the field was present
	in the log config file.
	(openvas_log_func): Always set the default level from the config if the
	level was present in the log config file (including if the level is 0).

Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2009-09-30 09:59:39 UTC (rev 5327)
+++ trunk/openvas-libraries/ChangeLog	2009-09-30 10:58:00 UTC (rev 5328)
@@ -1,5 +1,14 @@
-2009-09-28  Matthew Mundell <matthew.mundell@intevation.de>
+2009-09-30  Matthew Mundell <matthew.mundell@intevation.de>
 
+	* nasl/openvas_logging.c (openvas_logging_t, load_log_configuration)
+	(free_log_configuration): Change the default_level field to a gint
+	pointer, so that it's possible to reliably tell if the field was present
+	in the log config file.
+	(openvas_log_func): Always set the default level from the config if the
+	level was present in the log config file (including if the level is 0).
+
+2009-09-29  Matthew Mundell <matthew.mundell@intevation.de>
+
 	* nasl/openvas_logging.c (openvas_log_func): On failure to create the log
 	file, ensure that the directory exists and try open the file again.
 

Modified: trunk/openvas-libraries/misc/openvas_logging.c
===================================================================
--- trunk/openvas-libraries/misc/openvas_logging.c	2009-09-30 09:59:39 UTC (rev 5327)
+++ trunk/openvas-libraries/misc/openvas_logging.c	2009-09-30 10:58:00 UTC (rev 5328)
@@ -59,7 +59,7 @@
   gchar *prepend_string;     ///< Prepend this string before every message.
   gchar *prepend_time_format; ///< If prependstring has %t, format for strftime.
   gchar *log_file;           ///< Where to log to.
-  GLogLevelFlags default_level; ///< What severity level to use as default.
+  GLogLevelFlags *default_level; ///< What severity level to use as default.
   GIOChannel *log_channel;   ///< Gio Channel - FD holder for logfile.
 } openvas_logging_t;
 
@@ -178,7 +178,7 @@
       log_domain_entry->prepend_string = NULL;
       log_domain_entry->prepend_time_format = NULL;
       log_domain_entry->log_file = NULL;
-      log_domain_entry->default_level = 0;
+      log_domain_entry->default_level = NULL;
       log_domain_entry->log_channel = NULL;
 
 
@@ -211,7 +211,8 @@
 
           level = g_key_file_get_value (key_file, *group, "level", &error);
           level = g_strchug (level);
-          log_domain_entry->default_level = level_int_from_string (level);
+          log_domain_entry->default_level = g_malloc (sizeof (gint));
+          *log_domain_entry->default_level = level_int_from_string (level);
           g_free (level);
         }
 
@@ -255,6 +256,7 @@
       g_free (log_domain_entry->prepend_string);
       g_free (log_domain_entry->prepend_time_format);
       g_free (log_domain_entry->log_file);
+      g_free (log_domain_entry->default_level);
 
       /* Drop the reference to the GIOChannel. */
       if (log_domain_entry->log_channel)
@@ -339,7 +341,7 @@
               if (log_domain_entry->log_file)
                 log_file = log_domain_entry->log_file;
               if (log_domain_entry->default_level)
-                default_level = log_domain_entry->default_level;
+                default_level = *log_domain_entry->default_level;
               if (log_domain_entry->log_channel)
                 channel = log_domain_entry->log_channel;
               break;
@@ -375,7 +377,8 @@
               prepend_format = log_domain_entry->prepend_string;
               time_format = log_domain_entry->prepend_time_format;
               log_file = log_domain_entry->log_file;
-              default_level = log_domain_entry->default_level;
+              if (log_domain_entry->default_level)
+                default_level = *log_domain_entry->default_level;
               channel = log_domain_entry->log_channel;
               break;
             }

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
http://lists.wald.intevation.org/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic