add_log_severity¶
- safir.logging.add_log_severity(logger: logging.Logger, method_name: str, event_dict: MutableMapping[str, Any]) MutableMapping[str, Any]¶
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_levelexcept that it uses theseveritykey rather thanlevelfor compatibility with Google Log Explorer and its automatic processing of structured logs.- Parameters
logger (
logging.Logger) – The wrapped logger object.method_name (
str) – The name of the wrapped method (warningorerror, for example).event_dict (
structlog.types.EventDict) – Current context and current event. This parameter is also modified in place, matching the normal behavior of structlog processors.
- Returns
event_dict – The modified
EventDictwith the added key.- Return type