Updated so that the debug functor only attempts its job if logging debug is on.
This commit is contained in:
parent
4f1a8c547f
commit
0b249a6283
@ -58,9 +58,11 @@ SysLogHandler = SysLogHandler
|
|||||||
def log_debug(f):
|
def log_debug(f):
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kw):
|
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)
|
rv = f(*args, **kw)
|
||||||
logging.debug(pprint.pformat(rv, indent=2))
|
if root.isEnabledFor(debug):
|
||||||
logging.debug('')
|
logging.debug(pprint.pformat(rv, indent=2))
|
||||||
|
logging.debug('')
|
||||||
return rv
|
return rv
|
||||||
return wrapper
|
return wrapper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user