Prepare file configured logging
authorTobias Mueller <tobiasmue@gnome.org>
Thu, 13 Jan 2011 16:44:48 +0000 (17:44 +0100)
committerTobias Mueller <tobiasmue@gnome.org>
Thu, 13 Jan 2011 16:44:48 +0000 (17:44 +0100)
It seems like it's a bit complicated to set up, hence it's just a FIXME right now.
But the general idea is to have a configurable logging mechanism.

pwnitter.py

index 67d3f75..4ef93eb 100755 (executable)
@@ -8,6 +8,7 @@ import dbus.service
 import dbus.mainloop.glib
 import getopt, sys, pcap, dpkt, re, httplib, urllib
 import logging
+import logging.config
 import socket
 import time
 import gobject
@@ -239,6 +240,7 @@ if __name__ == '__main__':
                 'warn': logging.WARN, 'error': logging.ERROR,
                 'critical': logging.CRITICAL}.get(options.loglevel, "warn")
     logging.basicConfig(level=loglevel)
+    #logging.config.fileConfig('logging.conf') #FIXME: Have file configured logging
     log = logging.getLogger("Main")
 
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -252,7 +254,7 @@ if __name__ == '__main__':
     #object.Start()
 
     loop = gobject.MainLoop()
-    print "Running example signal emitter service."
+    log.info("Running example signal emitter service.")
     # FIXME: This is debug code
     #gobject.idle_add(pwnitter.MessageSent)