summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2010-08-24 13:24:47 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2010-08-24 13:24:47 +0200
commit9739192af1085e9f2fcf83b5e446c16801ae870a (patch)
treebdb95e40e168f5b21ad160f7fbd7a90133057688
parente88ea135e3d93f4f1584d14090f43b2cd467c7d7 (diff)
downloadlogilab-common-9739192af1085e9f2fcf83b5e446c16801ae870a.tar.gz
if debug is true and no threshost specified, default to DEBUG
-rw-r--r--logging_ext.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/logging_ext.py b/logging_ext.py
index bf5447b..cfefc4c 100644
--- a/logging_ext.py
+++ b/logging_ext.py
@@ -125,7 +125,10 @@ def init_log(debug=False, syslog=False, logthreshold=None, logfile=None,
except IOError:
handler = logging.StreamHandler()
if logthreshold is None:
- logthreshold = logging.ERROR
+ if debug:
+ logthreshold = logging.DEBUG
+ else:
+ logthreshold = logging.ERROR
elif isinstance(logthreshold, basestring):
logthreshold = getattr(logging, THRESHOLD_MAP.get(logthreshold,
logthreshold))