From 0b249a6283978ee43a5adbffdd6103612203f146 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 14 Feb 2012 21:16:21 -0800 Subject: [PATCH] Updated so that the debug functor only attempts its job if logging debug is on. --- devstack/log.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/devstack/log.py b/devstack/log.py index c70249a1..0d989532 100644 --- a/devstack/log.py +++ b/devstack/log.py @@ -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