In configure we do not need to set_config()
[cascardo/ipsilon.git] / ipsilon / util / log.py
1 #!/usr/bin/python
2 #
3 # Copyright (C) 2014 Ipsilon Project Contributors
4 #
5 # See the file named COPYING for the project license
6
7 import cherrypy
8 import inspect
9
10
11 class Log(object):
12
13     def debug(self, fact):
14         if cherrypy.config.get('debug', False):
15             s = inspect.stack()
16             cherrypy.log('DEBUG(%s): %s' % (s[1][3], fact))
17
18     # for compatibility with existing code
19     _debug = debug
20
21     def log(self, fact):
22         cherrypy.log(fact)
23
24     def error(self, fact):
25         cherrypy.log.error('ERROR: %s' % fact)