mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-16 12:09:14 -04:00
Fix for structured logging tests stomping on logs (#6023)
This commit is contained in:
parent
3d882a7ba5
commit
b617864cd9
13 changed files with 154 additions and 41 deletions
|
@ -18,6 +18,7 @@ import os.path
|
|||
import sys
|
||||
import typing
|
||||
import warnings
|
||||
from typing import List
|
||||
|
||||
import attr
|
||||
from constantly import NamedConstant, Names, ValueConstant, Values
|
||||
|
@ -33,7 +34,6 @@ from twisted.logger import (
|
|||
LogLevelFilterPredicate,
|
||||
LogPublisher,
|
||||
eventAsText,
|
||||
globalLogBeginner,
|
||||
jsonFileLogObserver,
|
||||
)
|
||||
|
||||
|
@ -134,7 +134,7 @@ class PythonStdlibToTwistedLogger(logging.Handler):
|
|||
)
|
||||
|
||||
|
||||
def SynapseFileLogObserver(outFile: typing.io.TextIO) -> FileLogObserver:
|
||||
def SynapseFileLogObserver(outFile: typing.IO[str]) -> FileLogObserver:
|
||||
"""
|
||||
A log observer that formats events like the traditional log formatter and
|
||||
sends them to `outFile`.
|
||||
|
@ -265,7 +265,7 @@ def setup_structured_logging(
|
|||
hs,
|
||||
config,
|
||||
log_config: dict,
|
||||
logBeginner: LogBeginner = globalLogBeginner,
|
||||
logBeginner: LogBeginner,
|
||||
redirect_stdlib_logging: bool = True,
|
||||
) -> LogPublisher:
|
||||
"""
|
||||
|
@ -286,7 +286,7 @@ def setup_structured_logging(
|
|||
if "drains" not in log_config:
|
||||
raise ConfigError("The logging configuration requires a list of drains.")
|
||||
|
||||
observers = []
|
||||
observers = [] # type: List[ILogObserver]
|
||||
|
||||
for observer in parse_drain_configs(log_config["drains"]):
|
||||
# Pipe drains
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue