diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-02-01 18:53:42 +0100 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-02-01 18:53:42 +0100 |
commit | e9c3d3cb51a7753a94f926154c192fba863cc395 (patch) | |
tree | b76c01969ce67392290c8e4074e94e91cd827930 /pyfirstaidkit/__init__.py | |
parent | 7a4683d8c30f89e7eb5a9cb3cbacee4da6f77ac6 (diff) | |
download | firstaidkit-e9c3d3cb51a7753a94f926154c192fba863cc395.tar.gz firstaidkit-e9c3d3cb51a7753a94f926154c192fba863cc395.tar.xz firstaidkit-e9c3d3cb51a7753a94f926154c192fba863cc395.zip |
The log in __builtins__ might have some strange sideeffects.
Diffstat (limited to 'pyfirstaidkit/__init__.py')
-rw-r--r-- | pyfirstaidkit/__init__.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/pyfirstaidkit/__init__.py b/pyfirstaidkit/__init__.py index a92e797..a9a33f4 100644 --- a/pyfirstaidkit/__init__.py +++ b/pyfirstaidkit/__init__.py @@ -19,21 +19,16 @@ from interpret import Tasker from configuration import Config #from log import Logger import logging -import __builtin__ import sys -class FAKLogger: - """Describes the logger that will be used only by the pluginsystem. - - When instanciated it will put the logger in builtins so it is reachable - from everywhere in the code. """ - def __init__(self, config): - Logger = logging.getLogger("firstaidkit") - Logger.setLevel(logging.DEBUG) - if config.log.method == "stdout": - Logger.addHandler(logging.StreamHandler(sys.stdout)) - else: - # if nothing else matches we just put it into the file. - Logger.addHandler(logging.FileHandler(config.log.filename)) - __builtin__.Logger = Logger +Logger=None +def initLogger(config=None): + """We want to initialize loger when we have the filename.""" + Logger = logging.getLogger("firstaidkit") + Logger.setLevel(logging.DEBUG) + if config.log.method == "stdout" or config.log.method == None: + Logger.addHandler(logging.StreamHandler(sys.stdout)) + else: + # if nothing else matches we just put it into the file. + Logger.addHandler(logging.FileHandler(config.log.filename)) |