dogtail-devel [PATCH] Option to suppress log output
- From: Cole Robinson <crobinso redhat com>
- To: dogtail-devel-list gnome org
- Subject: dogtail-devel [PATCH] Option to suppress log output
- Date: Thu, 27 Sep 2007 11:25:53 -0400
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.
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.
+
+ 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/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.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]