archivebox.core.settings_logging
Module Contents
Classes
Drop daphne’s noisy “killed slow response after client disconnect” warning. |
|
Drop asyncio’s “CancelledError exception in shielded future” noise. |
|
Data
API
- class archivebox.core.settings_logging.DaphneCloseTimeoutFilter(name='')[source]
Bases:
logging.FilterDrop daphne’s noisy “killed slow response after client disconnect” warning.
Daphne emits this whenever a request handler is still running when the client disconnects (e.g. iframe gets navigated away mid-response while fetching favicon / screenshot / preview html). For our use case these are always benign — the disconnect is the browser cancelling a request, not a server-side fault — so we suppress them outright rather than spamming WARNING. Other daphne.server lines pass through unchanged.
Initialization
Initialize a filter.
Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.
- class archivebox.core.settings_logging.AsyncioCancelledShieldFilter(name='')[source]
Bases:
logging.FilterDrop asyncio’s “CancelledError exception in shielded future” noise.
When a browser disconnects mid-request, daphne cancels the asgi task and asgiref’s
sync_to_asyncshields the synchronous Django view viaasyncio.shield(exec_coro). The shield wakes up to find its parent cancelled and re-raisesCancelledError; asyncio’s default exception handler then logs the full traceback via theasynciologger. There’s nothing the server can do (the client is already gone), so these tracebacks are pure noise and cause hundreds of lines of spam per disconnect.We match conservatively: only drop the specific shielded-future message that points back into asgiref’s shield path. Other asyncio errors fall through unchanged.
Initialization
Initialize a filter.
Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.
- class archivebox.core.settings_logging.CustomOutboundWebhookLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]
Bases:
logging.Formatter