summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2010-09-23 14:26:00 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2010-09-23 14:26:00 +0200
commita4d541d67062fe234be812c7ee83a8f48440916b (patch)
tree7b35fb9ccfae87f3a5d3d478dbb10332408aeb04
parent82225530aca4fbfe5520e759d6ccc8adc75c3d52 (diff)
downloadlogilab-common-a4d541d67062fe234be812c7ee83a8f48440916b.tar.gz
[logging]?dont attempt to use color formatter unless asked for debug mode
-rw-r--r--logging_ext.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/logging_ext.py b/logging_ext.py
index e87aace..0eba371 100644
--- a/logging_ext.py
+++ b/logging_ext.py
@@ -159,7 +159,10 @@ def init_log(debug=False, syslog=False, logthreshold=None, logfile=None,
logthreshold = get_threshold(debug, logthreshold)
logger.setLevel(logthreshold)
if fmt is None:
- fmt = get_formatter(logformat=LOG_FORMAT, logdateformat=LOG_DATE_FORMAT)
+ if debug:
+ fmt = get_formatter(logformat=logformat, logdateformat=logdateformat)
+ else:
+ fmt = logging.Formatter(logformat, logdateformat)
handler.setFormatter(fmt)
return handler