From cfdba060504929f2ae2a99e1e8c5c61f61afef63 Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Thu, 10 Oct 2013 15:07:47 +0200 Subject: 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. --- src/python/lmi/providers/cmpi_logging.py | 15 ++++++++------- 1 file 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 -- cgit