From 8d98337ffef80a45375258f722d7493bf0eff167 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 2 Mar 2009 23:27:05 +0100 Subject: [PATCH] Add thread name to log output when threads are enabled. --- linkcheck/configuration/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py index 378a098a..d1cb198b 100644 --- a/linkcheck/configuration/__init__.py +++ b/linkcheck/configuration/__init__.py @@ -168,10 +168,14 @@ class Configuration (dict): logging.config.fileConfig(filename) if handler is None: handler = ansicolor.ColoredStreamHandler(strm=sys.stderr) - handler.setFormatter(logging.Formatter("%(levelname)s %(message)s")) logging.getLogger(LOG_ROOT).addHandler(handler) self.set_debug(debug) self.status_logger = status_logger + if self['threads'] > 0: + format = "%(levelname)s %(threadName)s %(message)s" + else: + format = "%(levelname)s %(message)s" + handler.setFormatter(logging.Formatter(format)) def set_debug (self, debug): """Set debugging levels for configured loggers. The argument