diff options
author | Ales Kozumplik <akozumpl@redhat.com> | 2010-01-25 15:57:56 +0100 |
---|---|---|
committer | Ales Kozumplik <akozumpl@redhat.com> | 2010-01-29 14:13:19 +0100 |
commit | 6e7db4f1cb954c3f7402c4ddef4e75aecd17a684 (patch) | |
tree | 3dbd9f300ec8f113b7c9f9846ded105e658a5379 /anaconda_log.py | |
parent | d3ba5c26275dcce02f3624ec52b40001dd287706 (diff) | |
download | anaconda-6e7db4f1cb954c3f7402c4ddef4e75aecd17a684.tar.gz anaconda-6e7db4f1cb954c3f7402c4ddef4e75aecd17a684.tar.xz anaconda-6e7db4f1cb954c3f7402c4ddef4e75aecd17a684.zip |
rename constants and a variable in anconda_log.py so the names make more sense.
Diffstat (limited to 'anaconda_log.py')
-rw-r--r-- | anaconda_log.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/anaconda_log.py b/anaconda_log.py index 40d3979a1..3f7baa38b 100644 --- a/anaconda_log.py +++ b/anaconda_log.py @@ -27,10 +27,10 @@ import logging from logging.handlers import SysLogHandler, SYSLOG_UDP_PORT import types -DEFAULT_LEVEL = logging.INFO -DEFAULT_ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s" -DEFAULT_TTY_FORMAT = "%(levelname)s %(name)s: %(message)s" -DEFAULT_DATE_FORMAT = "%H:%M:%S" +DEFAULT_TTY_LEVEL = logging.INFO +ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s" +TTY_FORMAT = "%(levelname)s %(name)s: %(message)s" +DATE_FORMAT = "%H:%M:%S" MAIN_LOG_FILE = "/tmp/anaconda.log" PROGRAM_LOG_FILE = "/tmp/program.log" @@ -64,8 +64,8 @@ class AnacondaSyslogHandler(SysLogHandler): record.msg = original_msg class AnacondaLog: - def __init__ (self, minLevel=DEFAULT_LEVEL): - self.loglevel = logging.DEBUG + def __init__ (self, minLevel=DEFAULT_TTY_LEVEL): + self.tty_loglevel = DEFAULT_TTY_LEVEL self.remote_syslog = None # Create the base of the logger hierarcy. self.logger = logging.getLogger("anaconda") @@ -93,8 +93,8 @@ class AnacondaLog: fmtStr="%(asctime)s %(message)s", minLevel=logging.INFO) # Add a simple handler - file or stream, depending on what we're given. - def addFileHandler (self, file, addToLogger, minLevel=DEFAULT_LEVEL, - fmtStr=DEFAULT_ENTRY_FORMAT, + def addFileHandler (self, file, addToLogger, minLevel=DEFAULT_TTY_LEVEL, + fmtStr=ENTRY_FORMAT, autoLevel=True): if isinstance(file, types.StringTypes): logfileHandler = logging.FileHandler(file) @@ -102,19 +102,19 @@ class AnacondaLog: logfileHandler = logging.StreamHandler(file) logfileHandler.setLevel(minLevel) - logfileHandler.setFormatter(logging.Formatter(fmtStr, DEFAULT_DATE_FORMAT)) + logfileHandler.setFormatter(logging.Formatter(fmtStr, DATE_FORMAT)) autoSetLevel(logfileHandler, autoLevel) addToLogger.addHandler(logfileHandler) # Add another logger to the hierarchy. For best results, make sure # name falls under anaconda in the tree. - def addLogger (self, name, minLevel=DEFAULT_LEVEL): + def addLogger (self, name, minLevel=DEFAULT_TTY_LEVEL): newLogger = logging.getLogger(name) newLogger.setLevel(minLevel) # Add a handler for remote syslogs. def addSysLogHandler (self, logger, host, port=SYSLOG_UDP_PORT, - minLevel=DEFAULT_LEVEL): + minLevel=DEFAULT_TTY_LEVEL): fmt = logging.Formatter("%(levelname)-8s %(message)s") syslogHandler = SysLogHandler((host, port)) syslogHandler.setLevel(minLevel) |