Hi,
I discovered a tiny little annoyance in the code where we set up the
loggers. If no logger is specified, the code defaults to the
NullLogger. Is this a known issue/feature? I was scratching my head
over why some of my daemons weren't starting up properly and, since no
logger parameters were set up in the configuration file, I had no way
of knowing what was going on under the hood. I was expecting the
information to be dumped on STDERR instead.

Attaching a little patch to address this issue(?), where the
destination is set to STDERR in case no 'log_to' becomes 'none'. I
might have been wrong in removing NullLogger altogether though. :)

Thanks and Regards
Sudharshan S
Blog : http://sudharsh.wordpress.com
From 91c63e5c00163d7e2b3a917b529d68c71a4c92fc Mon Sep 17 00:00:00 2001
From: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com>
Date: Sun, 13 Sep 2009 21:23:39 +0530
Subject: [PATCH] Default to STDERR if no logger is specified. Remove NullLogger in the process


Signed-off-by: Sudharshan 'Sup3rkiddo' S <sudha...@gmail.com>
---
 libfsobasics/fsobasics/logger.vala |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/libfsobasics/fsobasics/logger.vala b/libfsobasics/fsobasics/logger.vala
index 4589c20..03d7d53 100644
--- a/libfsobasics/fsobasics/logger.vala
+++ b/libfsobasics/fsobasics/logger.vala
@@ -126,13 +126,10 @@ public interface FsoFramework.Logger : Object
                 var logger = new SyslogLogger( domain );
                 theLogger = logger;
                 break;
-            case "none":
-                var logger = new NullLogger( domain );
-                theLogger = logger;
-                break;
             default:
-                GLib.warning( "Don't know how to instanciate logger type '%s'. Using NullLogger.", log_to );
-                var logger = new NullLogger( domain );
+                GLib.warning( "Don't know how to instanciate logger type '%s'. Defaulting to STDERR", log_to );
+                var logger = new FileLogger( domain );
+                logger.setFile ( "stderr" );
                 theLogger = logger;
                 break;
         }
@@ -269,20 +266,6 @@ public abstract class FsoFramework.AbstractLogger : FsoFramework.Logger, Object
     }
 }
 
-/**
- * NullLogger
- */
-public class FsoFramework.NullLogger : FsoFramework.AbstractLogger
-{
-    public NullLogger( string domain )
-    {
-        base( domain );
-    }
-
-    protected override void write( string message )
-    {
-    }
-}
 
 /**
  * FileLogger
-- 
1.6.0.4

_______________________________________________
smartphones-standards mailing list
smartphones-standards@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-standards

Reply via email to