diff options
author | Simo Sorce <simo@redhat.com> | 2014-08-28 14:25:15 -0400 |
---|---|---|
committer | Patrick Uiterwijk <puiterwijk@redhat.com> | 2014-09-24 20:29:39 +0200 |
commit | 9c13685d58b242c865fd203fd7b4a239fbf07ac1 (patch) | |
tree | c8713c801c8d01a25944be95aadecb1aa007b343 | |
parent | ccd28c8113c715ece7aa48febbe03ceccac0d733 (diff) | |
download | ipsilon-9c13685d58b242c865fd203fd7b4a239fbf07ac1.tar.gz ipsilon-9c13685d58b242c865fd203fd7b4a239fbf07ac1.tar.xz ipsilon-9c13685d58b242c865fd203fd7b4a239fbf07ac1.zip |
Add error log facility to Log utility
Also improve debug errors by adding the originating function
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
-rwxr-xr-x | ipsilon/util/log.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ipsilon/util/log.py b/ipsilon/util/log.py index 3000bb5..dc557e3 100755 --- a/ipsilon/util/log.py +++ b/ipsilon/util/log.py @@ -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) |