[Zope3-checkins] SVN: Zope3/trunk/src/zope/testing/test.py if there
is no log.ini, cause the logging package to be completely silent
Fred L. Drake, Jr.
fred at zope.com
Mon May 17 17:08:34 EDT 2004
Log message for revision 24792:
if there is no log.ini, cause the logging package to be completely silent
-=-
Modified: Zope3/trunk/src/zope/testing/test.py
===================================================================
--- Zope3/trunk/src/zope/testing/test.py 2004-05-17 20:55:07 UTC (rev 24791)
+++ Zope3/trunk/src/zope/testing/test.py 2004-05-17 21:08:33 UTC (rev 24792)
@@ -237,6 +237,7 @@
import gc
import hotshot, hotshot.stats
+import logging
import os
import re
import pdb
@@ -799,6 +800,10 @@
if os.path.exists(logini):
logging.config.fileConfig(logini)
else:
+ # If there's no log.ini, cause the logging package to be
+ # silent during testing.
+ root = logging.getLogger()
+ root.addHandler(NullHandler())
logging.basicConfig()
if os.environ.has_key("LOGGING"):
@@ -806,6 +811,16 @@
logging.getLogger().setLevel(level)
+class NullHandler(logging.Handler):
+ """Logging handler that drops everything on the floor.
+
+ We require silence in the test environment. Hush.
+ """
+
+ def emit(self, record):
+ pass
+
+
def process_args(argv=None):
import getopt
global MODULE_FILTER
More information about the Zope3-Checkins
mailing list