From 9a9987be67d8ac3cad703bcdd96e8c5966e809da Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 26 Jun 2008 00:47:44 +0200 Subject: Introduce logging module --- src/nbb.in | 13 +++++++++++++ src/nbblib/bs.py | 4 ++-- src/nbblib/vcs.py | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nbb.in b/src/nbb.in index d4d2c62..ac3b00e 100644 --- a/src/nbb.in +++ b/src/nbb.in @@ -14,6 +14,19 @@ if sys.version_info < (2,4): print "Fatal: This program requires Python 2.4 or later." sys.exit(3) +import logging # since python 2.3 + +# funcName: Since python 2.5 +# format="%(filename)s:%(lineno)d:%(funcName)s:" +logging.basicConfig(level = logging.DEBUG, + format = "%(levelname)s: %(message)s", + stream = sys.stderr) +if False: + logging.debug("xxx debug") + logging.info("xxx info") + logging.warning("xxx warn") + logging.error("xxx error") + if __name__ == '__main__': pythondir = "@pythondir@" lib_found = False diff --git a/src/nbblib/bs.py b/src/nbblib/bs.py index ac09b97..70f4ee0 100644 --- a/src/nbblib/bs.py +++ b/src/nbblib/bs.py @@ -46,13 +46,13 @@ class BSSourceTree(object): """Find BS tree type and return it""" if len(cls.plugins) < 1: raise NoPluginsRegistered(cls) - logging.debug("CLASS %s", cls) + #logging.debug("CLASS %s", cls) matches = PluginDict() for key, klass in cls.plugins.iteritems(): try: t = klass(vcs_tree, context) if t.tree_root() == vcs_tree.tree_root(): - logging.debug("KLASS %s", klass) + #logging.debug("KLASS %s", klass) matches[key] = t except NotABSSourceTree, e: pass diff --git a/src/nbblib/vcs.py b/src/nbblib/vcs.py index 91c36c5..f9b7dd3 100644 --- a/src/nbblib/vcs.py +++ b/src/nbblib/vcs.py @@ -74,13 +74,13 @@ class VCSourceTree(object): """Detect VCS tree type and return object representing it""" if len(cls.plugins) < 1: raise NoPluginsRegistered(cls) - logging.debug("CLASS %s", cls) + #logging.debug("CLASS %s", cls) matches = PluginDict() for key, klass in cls.plugins.iteritems(): try: t = klass(srcdir, context) if t.tree_root() == srcdir: - logging.debug("KLASS %s", klass) + #logging.debug("KLASS %s", klass) matches[key] = t except NotAVCSourceTree, e: pass -- cgit