aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-08-03 14:13:23 -0400
committerWaylan Limberg <waylan@gmail.com>2011-08-03 14:13:23 -0400
commit8606441ed7b854ba05b6ca4236512f1146a898a3 (patch)
tree65b9930da3d130bdd734befdf85b1347aa1a1024
parent362782d1e08089c74f5bfcf0937ace4fa5b49eea (diff)
downloadmarkdown-8606441ed7b854ba05b6ca4236512f1146a898a3.tar.gz
markdown-8606441ed7b854ba05b6ca4236512f1146a898a3.tar.bz2
markdown-8606441ed7b854ba05b6ca4236512f1146a898a3.zip
Cleaned up commandline script. Everything is in module now.
-rwxr-xr-xbin/markdown_py6
-rw-r--r--markdown/commandline.py6
2 files changed, 2 insertions, 10 deletions
diff --git a/bin/markdown_py b/bin/markdown_py
index b34cb66..111b2c1 100755
--- a/bin/markdown_py
+++ b/bin/markdown_py
@@ -29,13 +29,7 @@ Copyright 2004 Manfred Stienstra (the original version)
License: BSD (see docs/LICENSE for details).
"""
-import logging
from markdown import commandline
-# Setup a logger manually for compatibility with Python 2.3
-logger = logging.getLogger('MARKDOWN')
-logger.setLevel(commandline.COMMAND_LINE_LOGGING_LEVEL)
-logger.addHandler(logging.StreamHandler())
-
if __name__ == '__main__':
commandline.run()
diff --git a/markdown/commandline.py b/markdown/commandline.py
index caf9288..e2ef264 100644
--- a/markdown/commandline.py
+++ b/markdown/commandline.py
@@ -13,9 +13,6 @@ from logging import DEBUG, INFO, CRITICAL
logger = logging.getLogger('MARKDOWN')
-# default logging level for command-line use
-COMMAND_LINE_LOGGING_LEVEL = CRITICAL
-
def parse_options():
"""
Define and parse `optparse` options for command-line usage.
@@ -77,7 +74,8 @@ def run():
# Parse options and adjust logging level if necessary
options, logging_level = parse_options()
if not options: sys.exit(2)
- if logging_level: logger.setLevel(logging_level)
+ logger.setLevel(logging_level)
+ logger.addHandler(logging.StreamHandler())
# Run
markdown.markdownFromFile(**options)