Add error log facility to Log utility
authorSimo Sorce <simo@redhat.com>
Thu, 28 Aug 2014 18:25:15 +0000 (14:25 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Wed, 24 Sep 2014 18:29:39 +0000 (20:29 +0200)
Also improve debug errors by adding the originating function

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/util/log.py

index 3000bb5..dc557e3 100755 (executable)
@@ -5,16 +5,21 @@
 # See the file named COPYING for the project license
 
 import cherrypy
+import inspect
 
 
 class Log(object):
 
     def debug(self, fact):
         if cherrypy.config.get('debug', False):
-            cherrypy.log(fact)
+            s = inspect.stack()
+            cherrypy.log('DEBUG(%s): %s' % (s[1][3], fact))
 
     # for compatibility with existing code
     _debug = debug
 
     def log(self, fact):
         cherrypy.log(fact)
+
+    def error(self, fact):
+        cherrypy.log.error('ERROR: %s' % fact)