From d910a95c3a364c5bc8f2cab0217f2990f997293b Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Thu, 10 Feb 2011 00:37:20 +0200 Subject: [PATCH] core,data: Compatibility with old style log configs Allow log level to be specified in the old style, i-e just a number. --- src/rygel/rygel-log-handler.vala | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/rygel/rygel-log-handler.vala b/src/rygel/rygel-log-handler.vala index 514d908..3fc963f 100644 --- a/src/rygel/rygel-log-handler.vala +++ b/src/rygel/rygel-log-handler.vala @@ -71,13 +71,22 @@ public class Rygel.LogHandler : GLib.Object { foreach (var pair in log_levels.split (",")) { var tokens = pair.split (":"); - if (unlikely (tokens.length < 2)) { + if (tokens.length < 1) { break; } - var domain = tokens[0]; - var levels = (LogLevel) tokens[1].to_int (); - var flags = this.log_level_to_flags (levels); + string domain; + LogLevel level; + + if (tokens.length == 1) { + level = (LogLevel) tokens[0].to_int (); + domain = "*"; + } else { + domain = tokens[0]; + level = (LogLevel) tokens[1].to_int (); + } + + var flags = this.log_level_to_flags (level); this.log_level_hash[domain] = flags; } -- 2.7.4