LoggerDependency

class safir.dependencies.logger.LoggerDependency

Bases: object

Provides a structlog logger configured with request information.

The following additional information will be included:

  • A UUID for the request

  • The method and path of the request

  • The IP address of the client (as remote)

  • The User-Agent header of the request, if any.

Methods Summary

__call__(request)

Return a logger bound with request information.

Methods Documentation

__call__(request: starlette.requests.Request) structlog.stdlib.BoundLogger

Return a logger bound with request information.

Returns

logger – The bound logger.

Return type

structlog.stdlib.BoundLogger