aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGarret Raziel <boloomka@gmail.com>2014-06-02 14:32:19 +0200
committerMatěj Cepl <mcepl@redhat.com>2014-06-02 14:32:19 +0200
commit461a607f8ef0b4651cccdd4804e1419224c663ee (patch)
tree1297c0a199e686f8325b001cd664777c14003595
parenta25846aefaf75d51abd595c2498cab51f75b9f76 (diff)
downloadyamlish-461a607f8ef0b4651cccdd4804e1419224c663ee.tar.gz
fix of logging usage according to Python docs
https://docs.python.org/release/2.6/library\ /logging.html#configuring-logging-for-a-library
-rw-r--r--yamlish.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/yamlish.py b/yamlish.py
index a2e3188..467689a 100644
--- a/yamlish.py
+++ b/yamlish.py
@@ -112,6 +112,14 @@ from __future__ import absolute_import, print_function, unicode_literals
import logging
import yaml
+
+class NullHandler(logging.Handler):
+ def emit(self, record):
+ pass
+
+log = logging.getLogger("bayeux")
+log.addHandler(NullHandler())
+
__docformat__ = 'reStructuredText'
__version__ = "0.10"
__author__ = u"Matěj Cepl <mcepl_at_redhat_dot_com>"
@@ -168,16 +176,16 @@ def load(source):
many others).
"""
out = None
- logging.debug("inobj:\n%s", source)
+ log.debug("inobj:\n%s", source)
if isinstance(source, (str, unicode)):
out = yaml.load(source, Loader=_YamlishLoader)
- logging.debug("out (string) = %s", out)
+ log.debug("out (string) = %s", out)
elif hasattr(source, "__iter__"):
inobj = ""
for line in source:
inobj += line + '\n'
out = load(inobj)
- logging.debug("out (iter) = %s", out)
+ log.debug("out (iter) = %s", out)
return out
def dump(source, destination):