Updated so that the debug functor only attempts its job if logging debug is on.

This commit is contained in:
Joshua Harlow 2012-02-14 21:16:21 -08:00
parent 4f1a8c547f
commit 0b249a6283

View File

@ -58,9 +58,11 @@ SysLogHandler = SysLogHandler
def log_debug(f):
@functools.wraps(f)
def wrapper(*args, **kw):
logging.debug('%s(%s, %s) ->', f.func_name, str(args), str(kw))
if root.isEnabledFor(debug):
logging.debug('%s(%s, %s) ->', f.func_name, str(args), str(kw))
rv = f(*args, **kw)
logging.debug(pprint.pformat(rv, indent=2))
logging.debug('')
if root.isEnabledFor(debug):
logging.debug(pprint.pformat(rv, indent=2))
logging.debug('')
return rv
return wrapper