summary refs log tree commit diff
path: root/synapse/logging/_structured.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-11-26 18:56:54 +0000
committerErik Johnston <erik@matrix.org>2019-11-26 18:56:54 +0000
commitc665d154a2de73e559a9a4d79999aeeee5cc62a8 (patch)
tree5be10050ee0a44f1c5347e4f319f537c0896c446 /synapse/logging/_structured.py
parentMerge branch 'release-v1.6.0' of github.com:matrix-org/synapse into matrix-or... (diff)
parentRemove assertion and provide a clear warning on startup for missing public_ba... (diff)
downloadsynapse-c665d154a2de73e559a9a4d79999aeeee5cc62a8.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/logging/_structured.py')
-rw-r--r--synapse/logging/_structured.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/synapse/logging/_structured.py b/synapse/logging/_structured.py

index 334ddaf39a..ffa7b20ca8 100644 --- a/synapse/logging/_structured.py +++ b/synapse/logging/_structured.py
@@ -261,6 +261,18 @@ def parse_drain_configs( ) +class StoppableLogPublisher(LogPublisher): + """ + A log publisher that can tell its observers to shut down any external + communications. + """ + + def stop(self): + for obs in self._observers: + if hasattr(obs, "stop"): + obs.stop() + + def setup_structured_logging( hs, config, @@ -336,7 +348,7 @@ def setup_structured_logging( # We should never get here, but, just in case, throw an error. raise ConfigError("%s drain type cannot be configured" % (observer.type,)) - publisher = LogPublisher(*observers) + publisher = StoppableLogPublisher(*observers) log_filter = LogLevelFilterPredicate() for namespace, namespace_config in log_config.get(