diff options
-rw-r--r-- | markdown_link_style/logging.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/markdown_link_style/logging.py b/markdown_link_style/logging.py index 3707cab..2a93d7b 100644 --- a/markdown_link_style/logging.py +++ b/markdown_link_style/logging.py @@ -19,15 +19,23 @@ # <http://www.gnu.org/licenses/>. import logging +import sys class MDLSLogger(object): """Logging utility for modules in markdown-link-style. """ - def __init__(self, name): + def __init__(self, name, stream=sys.stdout): self.logger = logging.getLogger(name) + # Console handler. + sh = logging.StreamHandler(stream) + sh.setLevel(logging.DEBUG) + + # Add handler to logger. + self.logger.addHandler(sh) + def debug(self, msg, *args, **kwargs): self.logger.debug(msg, *args, **kwargs) |