From: Michael Tremer Date: Sat, 4 Aug 2012 14:40:57 +0000 (+0000) Subject: Format log messages, so one can see the origin of the message. X-Git-Tag: 0.0.2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b8cd5784722d87772075bb7558003e4ad3ff050;p=collecty.git Format log messages, so one can see the origin of the message. --- diff --git a/collecty/__init__.py b/collecty/__init__.py index 1585813..5c219e7 100644 --- a/collecty/__init__.py +++ b/collecty/__init__.py @@ -34,9 +34,12 @@ log = logging.getLogger("collecty") log.level = logging.DEBUG handler = logging.StreamHandler() -handler.level = logging.DEBUG +handler.setLevel(logging.DEBUG) log.handlers.append(handler) +formatter = logging.Formatter("%(asctime)s | %(name)-20s - %(levelname)-6s | %(message)s") +handler.setFormatter(formatter) + class ConfigError(Exception): pass @@ -45,6 +48,8 @@ class Collecty(object): self.config = configparser.ConfigParser() self.instances = [] + log.info(_("Collecty successfully initialized.")) + def read_config(self, config): self.config.read(config)