diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-10 15:07:47 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-10-10 15:43:09 +0200 |
commit | cfdba060504929f2ae2a99e1e8c5c61f61afef63 (patch) | |
tree | 63ac49a9316863d4d711fa50381ec98627cc2ef4 | |
parent | 0063553e0f3f89f3c5ec6f6c8b8d080296138ccd (diff) | |
download | openlmi-providers-cfdba060504929f2ae2a99e1e8c5c61f61afef63.tar.gz openlmi-providers-cfdba060504929f2ae2a99e1e8c5c61f61afef63.tar.xz openlmi-providers-cfdba060504929f2ae2a99e1e8c5c61f61afef63.zip |
python: changed the severity of function tracing messages
Tracing messages logging entries and exits of functions/methods polute
the trace logs greatly. Let's make them less severe making them
easy to suppress, while keeping other interesting messages enabled.
-rw-r--r-- | src/python/lmi/providers/cmpi_logging.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/python/lmi/providers/cmpi_logging.py b/src/python/lmi/providers/cmpi_logging.py index 4fc5df2..dca9ac8 100644 --- a/src/python/lmi/providers/cmpi_logging.py +++ b/src/python/lmi/providers/cmpi_logging.py @@ -236,7 +236,7 @@ def _trace_function_or_method(is_method=False, frame_level=1): """ logger = logging.getLogger(__name__+'.trace_function_or_method') logargs = {} - if logger.isEnabledFor(logging.DEBUG): + if logger.isEnabledFor(TRACE_VERBOSE): frm = inspect.currentframe() logargs.update({ "caller_file" : os.path.basename(os.path.splitext( @@ -257,20 +257,21 @@ def _trace_function_or_method(is_method=False, frame_level=1): logargs["args"] = "" else: logargs["args"] = " with args=(%s)" % logargs["args"] - logger.debug("%(caller_file)s:%(caller_lineno)d - %(action)s" - " %(module)s:%(func)s:%(lineno)d%(args)s" , logargs) + logger.trace_verbose("%(caller_file)s:%(caller_lineno)d - " + "%(action)s %(module)s:%(func)s:%(lineno)d%(args)s", + logargs) try: result = func(*args, **kwargs) - if logger.isEnabledFor(logging.DEBUG): + if logger.isEnabledFor(TRACE_VERBOSE): logargs["action"] = "exiting" - logger.debug("%(caller_file)s:%(caller_lineno)d" + logger.trace_verbose("%(caller_file)s:%(caller_lineno)d" " - %(action)s %(module)s:%(func)s:%(lineno)d", logargs) except Exception as exc: - if logger.isEnabledFor(logging.DEBUG): + if logger.isEnabledFor(TRACE_VERBOSE): logargs['action'] = 'exiting' logargs['error'] = str(exc) - logger.debug("%(caller_file)s:%(caller_lineno)d" + logger.trace_verbose("%(caller_file)s:%(caller_lineno)d" " - %(action)s %(module)s:%(func)s:%(lineno)d" " with error: %(error)s", logargs) raise |