aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Takhteyev <yuri@freewisdom.org>2008-10-06 12:11:47 -0700
committerYuri Takhteyev <yuri@freewisdom.org>2008-10-06 12:11:47 -0700
commit2c6a74f6770982694113705e4d9467d471f899a6 (patch)
treee126763096745dd079e3734d7817ec6edafc7186
parentca45f4c69eb87d4361a46d758a0936d63dbdee50 (diff)
downloadmarkdown-2c6a74f6770982694113705e4d9467d471f899a6.tar.gz
markdown-2c6a74f6770982694113705e4d9467d471f899a6.tar.bz2
markdown-2c6a74f6770982694113705e4d9467d471f899a6.zip
Checking if logger level is set before changing it.
-rwxr-xr-xmarkdown.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/markdown.py b/markdown.py
index 0d92766..92529c0 100755
--- a/markdown.py
+++ b/markdown.py
@@ -34,13 +34,14 @@ import re, sys, codecs, htmlentitydefs
from urlparse import urlparse, urlunparse
from logging import getLogger, StreamHandler, Formatter, \
- DEBUG, INFO, WARN, ERROR, CRITICAL
+ NOTSET, DEBUG, INFO, WARN, ERROR, CRITICAL
MESSAGE_THRESHOLD = CRITICAL
# Configure debug message logger (the hard way - to support python 2.3)
logger = getLogger('MARKDOWN')
-logger.setLevel(DEBUG) # This is restricted by handlers later
+if logger.level == NOTSET :
+ logger.setLevel(DEBUG) # This is restricted by handlers later
console_hndlr = StreamHandler()
formatter = Formatter('%(name)s-%(levelname)s: "%(message)s"')
console_hndlr.setFormatter(formatter)