From edb380f80163f87428f5ba9cbaa1904d099228c4 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 8 Sep 2021 10:48:32 -0400 Subject: [PATCH] Bridge Foolscap logs to Twisted's so they appear in test.log --- src/allmydata/test/__init__.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/__init__.py b/src/allmydata/test/__init__.py index 893aa15ce..8b11ffd17 100644 --- a/src/allmydata/test/__init__.py +++ b/src/allmydata/test/__init__.py @@ -55,9 +55,22 @@ def disable_foolscap_incidents(): iq = NonQualifier() theLogger.setIncidentQualifier(iq) -# we disable incident reporting for all unit tests. -disable_foolscap_incidents() +def bridge_foolscap_logs_to_twisted(): + # Dump all of the Foolscap logs into the Twisted logging system where they + # can get scooped up by any other log observers we configure. + from foolscap.logging import log + log.bridgeLogsToTwisted() +def configure_foolscap_logging(): + # we disable incident reporting for all unit tests. + disable_foolscap_incidents() + + # we want to collect Foolscap logs too, and it's easiest to do this by + # getting them into one of the log systems we already have collection set + # up for. + bridge_foolscap_logs_to_twisted() + +configure_foolscap_logging() def _configure_hypothesis(): from os import environ