[rygel] core: Only forward allowed log levels
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
 
- To: svn-commits-list gnome org
 
- Cc: 
 
- Subject: [rygel] core: Only forward allowed log levels
 
- Date: Mon, 28 Sep 2009 22:30:26 +0000 (UTC)
 
commit 426eac16806b3f5040ad6e2c29c0968e88e629cc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Sep 25 14:46:23 2009 +0300
    core: Only forward allowed log levels
    
    LogHandler can now be told which log levels are allowed.
 src/rygel/rygel-log-handler.vala |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-log-handler.vala b/src/rygel/rygel-log-handler.vala
index 1e8d077..4940ee2 100644
--- a/src/rygel/rygel-log-handler.vala
+++ b/src/rygel/rygel-log-handler.vala
@@ -23,6 +23,11 @@
 
 public class Rygel.LogHandler : GLib.Object {
     public const string DOMAIN = "Rygel";
+    private const LogLevelFlags DEFAULT_LEVELS = LogLevelFlags.LEVEL_WARNING |
+                                                 LogLevelFlags.LEVEL_CRITICAL |
+                                                 LogLevelFlags.LEVEL_ERROR;
+
+    public LogLevelFlags levels; // Current log levels
 
     private static LogHandler log_handler; // Singleton
 
@@ -38,6 +43,8 @@ public class Rygel.LogHandler : GLib.Object {
         Log.set_handler (DOMAIN,
                          LogLevelFlags.LEVEL_MASK | LogLevelFlags.FLAG_FATAL,
                          this.log_func);
+
+        this.levels = DEFAULT_LEVELS;
     }
 
     private void log_func (string?       log_domain,
@@ -45,7 +52,9 @@ public class Rygel.LogHandler : GLib.Object {
                            string        message) {
         assert (log_domain == DOMAIN);
 
-        // Just forward the message to default domain for now
-        log (null, log_levels, message);
+        if (log_levels in this.levels) {
+            // Just forward the message to default domain for now
+            log (null, log_levels, message);
+        }
     }
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]