academy.logging.helpers¶
JSONHandler
¶
JSONHandler(filename: Path)
Bases: Handler
A LogHandler which outputs records as JSON objects, one per line.
Source code in academy/logging/helpers.py
emit
¶
emit(record: LogRecord) -> None
Emits the log record as a JSON object.
Each attribute (including extra attributes) of the log record becomes
an entry in the JSON object. Each value is rendered using str.
Source code in academy/logging/helpers.py
execute_and_log_traceback
async
¶
Await a future and log any exception..
Warning
For developers. Other functions rely on the first await call to be on the wrapped future to that task cancellation can be properly caught in the wrapped task.
Catches any exceptions raised by the coroutine, logs the traceback, and re-raises the exception.
Source code in academy/logging/helpers.py
log_context
¶
Context manager for using an LogConfig.