Skip to content

logging ¤

Custom logging formatter for the Firefighter project.

custom_json_formatter ¤

CustomJsonFormatter ¤

CustomJsonFormatter(*args: Any, **kwargs: Any)

Bases: JsonFormatter

Custom JSON formatter for Python loggin, with Datadog specific attributes.

Source code in src/firefighter/logging/custom_json_formatter.py
def __init__(self, *args: Any, **kwargs: Any) -> None:
    self.FF_USER_ID_HEADER: str = settings.FF_USER_ID_HEADER
    super().__init__(*args, **kwargs)  # type: ignore[no-untyped-call]

pretty_formatter ¤

PrettyFormatter ¤

Bases: Formatter

A custom logging formatter that formats log records with colors and a pretty output, for local development.

Opiniated about what is pretty.

Attributes:

  • _style (_STYLES) –

    The logging style used for formatting.

  • _fmt (str) –

    The logging format string used for formatting.