summaryrefslogtreecommitdiffstats
path: root/ipsilon/util/log.py
blob: fb2c620b16305131136418d4a0ce503260115763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright (C) 2014 Ipsilon Project Contributors
#
# 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):
            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)