[master 2/2] rename constants and a variable in anconda_log.py so the names make more sense.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 anaconda               |    4 ++--
 anaconda_log.py        |   22 +++++++++++-----------
 storage/storage_log.py |    4 ++--
 yuminstall.py          |    6 +++---
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/anaconda b/anaconda
index ab8b088..5b0280a 100755
--- a/anaconda
+++ b/anaconda
@@ -303,7 +303,7 @@ def setupEnvironment():
 def setupLoggingFromOpts(opts):
     if opts.loglevel and anaconda_log.logLevelMap.has_key(opts.loglevel):
         level = anaconda_log.logLevelMap[opts.loglevel]
-        anaconda_log.logger.loglevel = level
+        anaconda_log.logger.tty_loglevel = level
         anaconda_log.setHandlersLevel(log, level)
         anaconda_log.setHandlersLevel(storage.storage_log.logger, level)
 
@@ -617,7 +617,7 @@ if __name__ == "__main__":
 
     if not iutil.isS390() and os.access("/dev/tty3", os.W_OK):
         anaconda_log.logger.addFileHandler("/dev/tty3", log,
-                                           fmtStr=anaconda_log.DEFAULT_TTY_FORMAT)
+                                           fmtStr=anaconda_log.TTY_FORMAT)
 
     warnings.showwarning = AnacondaShowWarning
 
diff --git a/anaconda_log.py b/anaconda_log.py
index 40d3979..3f7baa3 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)
diff --git a/storage/storage_log.py b/storage/storage_log.py
index b852270..e5dbadc 100644
--- a/storage/storage_log.py
+++ b/storage/storage_log.py
@@ -26,6 +26,6 @@ logger = logging.getLogger("storage")
 logger.setLevel(logging.DEBUG)
 anaconda_log.logger.addFileHandler("/tmp/storage.log", logger, logging.DEBUG)
 anaconda_log.logger.addFileHandler("/dev/tty3", logger,
-                                   anaconda_log.DEFAULT_LEVEL,
-                                   anaconda_log.DEFAULT_TTY_FORMAT)
+                                   anaconda_log.DEFAULT_TTY_LEVEL,
+                                   anaconda_log.TTY_FORMAT)
 anaconda_log.logger.forwardToSyslog(logger)
diff --git a/yuminstall.py b/yuminstall.py
index 8003902..2ba295d 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -619,8 +619,8 @@ class AnacondaYum(YumSorter):
         file_handler.setFormatter(file_formatter)
 
         tty3_handler = logging.FileHandler("/dev/tty3")
-        tty3_formatter = logging.Formatter(anaconda_log.DEFAULT_TTY_FORMAT,
-                                           anaconda_log.DEFAULT_DATE_FORMAT)
+        tty3_formatter = logging.Formatter(anaconda_log.TTY_FORMAT,
+                                           anaconda_log.DATE_FORMAT)
         tty3_handler.setFormatter(tty3_formatter)
 
         verbose = logging.getLogger("yum.verbose")
@@ -633,7 +633,7 @@ class AnacondaYum(YumSorter):
         logger.setLevel(yum.logginglevels.INFO_2)
         logger.addHandler(file_handler)
         anaconda_log.autoSetLevel(tty3_handler, True)
-        tty3_handler.setLevel(anaconda_log.logger.loglevel)
+        tty3_handler.setLevel(anaconda_log.logger.tty_loglevel)
         logger.addHandler(tty3_handler)
 
         # XXX filelogger is set in setFileLog - do we or user want it?
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux