Logging¶
Logging the traffic using python logging.
- class blacksmith.middleware._async.logging.AsyncLoggingMiddleware(logger: Logger | None = None, log_response: bool | None = None)¶
Logging Middleware based on an python logging.
- Parameters:
logger – the logger to use. By default the logger of the current module will be used.
log_response – force to log or not to log the http response body. logging the reponse body on a production server is discouraged here since it may reveal secrets since the logging happens before the pydantic validation. The default value is based on the logger level DEBUG. The error are logged with error level “ERROR” but requires the log_response to be true.
- log(req: HTTPRequest, client_name: str, path: str, status_code: int | None, error: Exception | None, latency: float) None¶
- __call__(next: AsyncMiddleware) AsyncMiddleware¶
Call self as a function.