logLevelMap = {"debug": logging.DEBUG, "info": logging.INFO,
"warning": logging.WARNING, "error": logging.ERROR,
@@ -57,10 +58,14 @@ class AnacondaLog:
# Create the base of the logger hierarcy.
self.logger = logging.getLogger("anaconda")
self.logger.setLevel(logging.DEBUG)
+ self.addFileHandler(MAIN_LOG_FILE, self.logger,
+ autoSetLevel=False, minLevel=logging.DEBUG)
- # Add a handler for the log file.
- self.addFileHandler (logFile, logging.getLogger("anaconda"),
- autoSetLevel=False, minLevel=logging.DEBUG)
+ # External program output log
+ program_logger = logging.getLogger("program")
+ program_logger.setLevel(logging.DEBUG)
+ self.addFileHandler(PROGRAM_LOG_FILE, program_logger,
+ autoSetLevel=False, minLevel=logging.DEBUG)
# Create a second logger for just the stuff we want to dup on
# stdout. Anything written here will also get passed up to the
diff --git a/iutil.py b/iutil.py
index 39d398a..f393f60 100644
--- a/iutil.py
+++ b/iutil.py
@@ -37,18 +37,16 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
#Python reimplementation of the shell tee process, so we can
#feed the pipe output into two places at the same time
class tee(threading.Thread):
- def __init__(self, inputdesc, outputdesc, outputfile):
+ def __init__(self, inputdesc, outputdesc, outputlog):
threading.Thread.__init__(self)
self.inputdesc = os.fdopen(inputdesc, "r")
self.outputdesc = outputdesc
- if isinstance(outputfile, file):
- self.file = outputfile
- else:
- self.file = open(outputfile, "a")
+ self.log = outputlog
self.running = True
def run(self):
@@ -57,7 +55,7 @@ class tee(threading.Thread):
if data == "":
self.running = False
else:
- self.file.write(data)
+ self.log.debug(data.rstrip('
'))
os.write(self.outputdesc, data)
def stop(self):
@@ -111,8 +109,7 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
elif stderr is None or not isinstance(stderr, file):
stderr = sys.stderr.fileno()