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

[master 2/2] Fix: execWithRedirect() logging stderr at wrong loglevel.



---
 iutil.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iutil.py b/iutil.py
index 70d7094..3fb4057 100644
--- a/iutil.py
+++ b/iutil.py
@@ -42,11 +42,11 @@ program_log = logging.getLogger("program")
 #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, outputlog):
+    def __init__(self, inputdesc, outputdesc, logmethod):
         threading.Thread.__init__(self)
         self.inputdesc = os.fdopen(inputdesc, "r")
         self.outputdesc = outputdesc
-        self.log = outputlog
+        self.logmethod = logmethod
         self.running = True
 
     def run(self):
@@ -55,7 +55,7 @@ class tee(threading.Thread):
             if data == "":
                 self.running = False
             else:
-                self.log.info(data.rstrip('\n'))
+                self.logmethod(data.rstrip('\n'))
                 os.write(self.outputdesc, data)
 
     def stop(self):
@@ -116,8 +116,8 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
 
     try:
         #prepare tee proceses
-        proc_std = tee(pstdout, stdout, program_log)
-        proc_err = tee(perrout, stderr, program_log)
+        proc_std = tee(pstdout, stdout, program_log.info)
+        proc_err = tee(perrout, stderr, program_log.error)
 
         #start monitoring the outputs
         proc_std.start()
-- 
1.6.2.5


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