Commit 24c6bfe8 authored by Jim Fulton's avatar Jim Fulton

added a little debug helper

To turn on debug logging.  A lot of interesting information helpful
when debugging network-implementation issues is logged (because
threads).
parent a62c62a5
...@@ -22,11 +22,11 @@ import socket ...@@ -22,11 +22,11 @@ import socket
import subprocess import subprocess
import logging import logging
import tempfile import tempfile
import logging
import six import six
import ZODB.tests.util import ZODB.tests.util
import zope.testing.setupstack import zope.testing.setupstack
from ZEO._compat import BytesIO from ZEO._compat import BytesIO
logger = logging.getLogger('ZEO.tests.forker') logger = logging.getLogger('ZEO.tests.forker')
class ZEOConfig: class ZEOConfig:
...@@ -388,3 +388,15 @@ def wait_connected(storage): ...@@ -388,3 +388,15 @@ def wait_connected(storage):
def wait_disconnected(storage): def wait_disconnected(storage):
wait_until("storage is disconnected", wait_until("storage is disconnected",
lambda : not storage.is_connected()) lambda : not storage.is_connected())
def debug_logging(logger='ZEO', stream='stderr', level=logging.DEBUG):
handler = logging.StreamHandler(getattr(sys, stream))
logger = logging.getLogger(logger)
logger.addHandler(handler)
logger.setLevel(level)
def stop():
logger.removeHandler(handler)
logger.setLevel(logging.NOTSET)
return stop
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment