diff options
author | Jason Kincl <kincljc@ornl.gov> | 2012-11-27 14:28:01 -0500 |
---|---|---|
committer | Jason Kincl <kincljc@ornl.gov> | 2012-11-27 14:28:01 -0500 |
commit | 5e0265f837f0eb72123be0b5150451aebdf8b031 (patch) | |
tree | dbd5fdbe4ec93c48cbba6fec3f608ffefb26eac5 /src/lib/Bcfg2/Logger.py | |
parent | 894299b01b6138c54a99fd41f166554d175d6106 (diff) | |
parent | 4c70626094248495bf2c11c09bf2f2f60917187d (diff) | |
download | bcfg2-5e0265f837f0eb72123be0b5150451aebdf8b031.tar.gz bcfg2-5e0265f837f0eb72123be0b5150451aebdf8b031.tar.bz2 bcfg2-5e0265f837f0eb72123be0b5150451aebdf8b031.zip |
Merge remote branch 'upstream/master' into jasons-hacking
Diffstat (limited to 'src/lib/Bcfg2/Logger.py')
-rw-r--r-- | src/lib/Bcfg2/Logger.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py index a06d6e79e..24028f71c 100644 --- a/src/lib/Bcfg2/Logger.py +++ b/src/lib/Bcfg2/Logger.py @@ -158,7 +158,7 @@ def add_syslog_handler(procname, syslog_facility, level=logging.DEBUG): logging.Formatter('%(name)s[%(process)d]: %(message)s')) logging.root.addHandler(syslog) except socket.error: - logging.root.error("failed to activate syslogging") + logging.root.error("Failed to activate syslogging") except: print("Failed to activate syslogging") @@ -178,17 +178,22 @@ def setup_logging(procname, to_console=True, to_syslog=True, if hasattr(logging, 'already_setup'): return + params = [] + if to_console: if to_console == True: - clvl = min(logging.WARNING, level) - else: - clvl = min(to_console, level) + to_console = logging.WARNING + clvl = min(to_console, level) + params.append("%s to console" % logging.getLevelName(clvl)) add_console_handler(clvl) if to_syslog: slvl = min(level, logging.INFO) + params.append("%s to syslog" % logging.getLevelName(slvl)) add_syslog_handler(procname, syslog_facility, level=slvl) if to_file is not None: + params.append("%s to %s" % (logging.getLevelName(level), to_file)) add_file_handler(to_file, level=level) logging.root.setLevel(logging.DEBUG) + logging.root.debug("Configured logging: %s" % "; ".join(params)) logging.already_setup = True |