add_log_severity#

safir.logging.add_log_severity(logger, method_name, event_dict)#

Add the log level to the event dict as severity.

Intended for use as a structlog processor.

This is the same as structlog.stdlib.add_log_level except that it uses the severity key rather than level for compatibility with Google Log Explorer and its automatic processing of structured logs.

Parameters:
  • logger (Logger) – The wrapped logger object.

  • method_name (str) – The name of the wrapped method (warning or error, for example).

  • event_dict (MutableMapping[str, Any]) – Current context and current event. This parameter is also modified in place, matching the normal behavior of structlog processors.

Returns:

The modified structlog.types.EventDict with the added key.

Return type:

structlog.types.EventDict