diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-09-13 02:29:55 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-13 02:29:55 +1000 |
commit | b617864cd9f81109e818bc5ae95bee317d917b72 (patch) | |
tree | 5bf6d0ee398731dc14ec73ac778ecaba98d0d3fb /synapse/logging/_terse_json.py | |
parent | Remove the cap on federation retry interval. (#6026) (diff) | |
download | synapse-b617864cd9f81109e818bc5ae95bee317d917b72.tar.xz |
Fix for structured logging tests stomping on logs (#6023)
Diffstat (limited to 'synapse/logging/_terse_json.py')
-rw-r--r-- | synapse/logging/_terse_json.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/logging/_terse_json.py b/synapse/logging/_terse_json.py index 7f1e8f23fe..0ebbde06f2 100644 --- a/synapse/logging/_terse_json.py +++ b/synapse/logging/_terse_json.py @@ -21,10 +21,11 @@ import sys from collections import deque from ipaddress import IPv4Address, IPv6Address, ip_address from math import floor -from typing.io import TextIO +from typing import IO import attr from simplejson import dumps +from zope.interface import implementer from twisted.application.internet import ClientService from twisted.internet.endpoints import ( @@ -33,7 +34,7 @@ from twisted.internet.endpoints import ( TCP6ClientEndpoint, ) from twisted.internet.protocol import Factory, Protocol -from twisted.logger import FileLogObserver, Logger +from twisted.logger import FileLogObserver, ILogObserver, Logger from twisted.python.failure import Failure @@ -129,7 +130,7 @@ def flatten_event(event: dict, metadata: dict, include_time: bool = False): return new_event -def TerseJSONToConsoleLogObserver(outFile: TextIO, metadata: dict) -> FileLogObserver: +def TerseJSONToConsoleLogObserver(outFile: IO[str], metadata: dict) -> FileLogObserver: """ A log observer that formats events to a flattened JSON representation. @@ -146,6 +147,7 @@ def TerseJSONToConsoleLogObserver(outFile: TextIO, metadata: dict) -> FileLogObs @attr.s +@implementer(ILogObserver) class TerseJSONToTCPLogObserver(object): """ An IObserver that writes JSON logs to a TCP target. |