Ticket #194: no-duplog.diff

File no-duplog.diff, 917 bytes (added by Brian Warner, 12 years ago)

incomplete patch (tests fail)

  • foolscap/logging/log.py

    diff --git a/foolscap/logging/log.py b/foolscap/logging/log.py
    index 5e9f5a2..7373117 100644
    a b class TwistedLogBridge: 
    371371        event['from-twisted'] = True
    372372        self.logger.msg(**event)
    373373
     374_bridgeLogsFromTwisted_active = False
    374375def bridgeLogsFromTwisted(tubID=None,
    375376                          twisted_logger=twisted_log.theLogPublisher,
    376377                          foolscap_logger=theLogger):
    def bridgeLogsFromTwisted(tubID=None, 
    381382    mostly for unit tests that don't want to modify the default instances.
    382383    For their benefit, I return the bridge.
    383384    """
     385    global _bridgeLogsFromTwisted_active
     386    if _bridgeLogsFromTwisted_active:
     387        return
     388    _bridgeLogsFromTwisted_active = True
    384389    tlb = TwistedLogBridge(tubID, foolscap_logger)
    385390    twisted_logger.addObserver(tlb.observer)
    386391    return tlb