Re: dogtail-devel [PATCH] Option to suppress log output



Zack Cerza wrote:
> Cole Robinson wrote:
>> Hi all,
>>
>> Attached is a patch that adds a config option to suppress printing log
>> output to stdout. For testing at build time this is nice as a lot of the
>> log messages don't indicate failure and thus should be at the discretion
>> of the tester.
> 
> Hi Cole,
> 
> OK, that's fair. Only thing I would change would be the actual name of 
> the option, so that it would better fit the naming scheme of the rest - 
> something like logDebugToStdOut. Long, but consistent nonetheless.
> 

Updated patch with recommended naming scheme. (And sent to whole list)

Thanks,
Cole

-- 
Cole Robinson
crobinso redhat com
Index: dogtail/config.py
===================================================================
--- dogtail/config.py	(revision 333)
+++ dogtail/config.py	(working copy)
@@ -101,6 +101,9 @@
 
     logDebugToFile (boolean):
     Whether to write debug output to a log file.
+
+    logDebugToStdOut (boolean):
+    Whether to print log output to console or not (default True).
     """
     __scriptName = staticmethod(_scriptName)
     __encoding = staticmethod(_encoding)
@@ -130,6 +133,7 @@
             'debugSearching' : False,
             'debugSleep' : False,
             'debugSearchPaths' : False,
+            'logDebugToStdOut' : True,
             'absoluteNodePaths' : False,
             'ensureSensitivity' : False,
             'debugTranslation' : False,
Index: dogtail/logging.py
===================================================================
--- dogtail/logging.py	(revision 333)
+++ dogtail/logging.py	(working copy)
@@ -162,6 +162,7 @@
             #self.file.close()
         except IOError:
             print "Could not create and write to " + self.fileName
+            self.file = False
 
     def log(self, message):
         """
@@ -175,7 +176,7 @@
             self.iconLogger.message(message)
         
         # Also write to standard out.
-        if self.stdOut: print message
+        if self.stdOut and config.logDebugToStdOut: print message
 
         # Try to open and write the result to the log file.
         if not self.file: return


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