LoggerDependency¶
- class safir.dependencies.logger.LoggerDependency¶
Bases:
objectProvides a structlog logger configured with request information.
The following additional information will be included:
A UUID for the request
The method and URL of the request
The IP address of the client
The
User-Agentheader of the request, if any.
The results of
XForwardedMiddlewarewill be honored if present. The last three pieces of information will be added using naming consistent with the expectations of Google Log Explorer so that the request information will be liftedn into the appropriate JSON fields for complex log queries.Methods Summary
__call__(request)Return a logger bound with request information.
Methods Documentation
- async __call__(request: starlette.requests.Request) structlog.stdlib.BoundLogger¶
Return a logger bound with request information.
- Returns
logger – The bound logger.
- Return type