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 URL of the request

  • The IP address of the client

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

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)#

Return a logger bound with request information.

Returns:

The bound logger.

Return type:

structlog.stdlib.BoundLogger

Parameters:

request (Request) –