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

[master 6/6] logging: initialize tty3 logging in anaconda_log, along with all other basic loggers.



---
 anaconda        |    7 -------
 anaconda_log.py |    8 ++++++++
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/anaconda b/anaconda
index 96595fa..951ff3e 100755
--- a/anaconda
+++ b/anaconda
@@ -808,14 +808,7 @@ if __name__ == "__main__":
     _ = lambda x: gettext.ldgettext("anaconda", x)
 
     anaconda = Anaconda()
-
-    if not iutil.isS390() and os.access("/dev/tty3", os.W_OK):
-        anaconda_log.logger.addFileHandler("/dev/tty3", log,
-                                           fmtStr=anaconda_log.TTY_FORMAT,
-                                           autoLevel=True)
-
     warnings.showwarning = AnacondaShowWarning
-
     setupTranslations()
 
     # reset python's default SIGINT handler
diff --git a/anaconda_log.py b/anaconda_log.py
index 6ce8955..74f97b7 100644
--- a/anaconda_log.py
+++ b/anaconda_log.py
@@ -29,6 +29,8 @@ import logging
 from logging.handlers import SysLogHandler, SYSLOG_UDP_PORT
 import types
 
+import iutil
+
 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"
@@ -36,6 +38,7 @@ STDOUT_FORMAT = "%(asctime)s %(message)s"
 DATE_FORMAT = "%H:%M:%S"
 
 MAIN_LOG_FILE = "/tmp/anaconda.log"
+MAIN_LOG_TTY = "/dev/tty3"
 PROGRAM_LOG_FILE = "/tmp/program.log"
 ANACONDA_SYSLOG_FACILITY = SysLogHandler.LOG_LOCAL1
 
@@ -76,6 +79,11 @@ class AnacondaLog:
         self.addFileHandler(MAIN_LOG_FILE, logger,
                             minLevel=logging.DEBUG)
         self.forwardToSyslog(logger)
+        # Log to tty3.
+        if not iutil.isS390() and os.access(MAIN_LOG_TTY, os.W_OK):
+            self.addFileHandler(MAIN_LOG_TTY, logger,
+                                fmtStr=TTY_FORMAT,
+                                autoLevel=True)
 
         # External program output log
         program_logger = logging.getLogger("program")
-- 
1.6.6


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