dogtail-devel [PATCH] Option to suppress log output

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.

Also there is a fix for a bug in here: if creating a log file fails,
logger.file is still True, so if anything tries to then log a message,
an exception is thrown. The fix was just to explicitly set logger.file
to False when creating the log file fails.


Cole Robinson
crobinso redhat com
Index: dogtail/
--- dogtail/	(revision 333)
+++ dogtail/	(working copy)
@@ -101,6 +101,9 @@
     logDebugToFile (boolean):
     Whether to write debug output to a log file.
+	debugStdout (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,
+            'debugStdout' : True,
             'absoluteNodePaths' : False,
             'ensureSensitivity' : False,
             'debugTranslation' : False,
Index: dogtail/
--- dogtail/	(revision 333)
+++ dogtail/	(working copy)
@@ -162,6 +162,7 @@
         except IOError:
             print "Could not create and write to " + self.fileName
+            self.file = False
     def log(self, message):
@@ -175,7 +176,7 @@
         # Also write to standard out.
-        if self.stdOut: print message
+        if self.stdOut and config.debugStdout: 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]