Skip to content

toolr.utils._logs

DuplicateTimesFormatter

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

Bases: Formatter

Formatter that adds a timestamp to the message, if it's not a duplicate.

Source code in python/toolr/utils/_logs.py
def __init__(self, *args: Any, **kwargs: Any) -> None:
    super().__init__(*args, **kwargs)
    self._last_timestamp: str | None = None

include_timestamps

include_timestamps() -> bool

Return True if any of the configured logging handlers includes timestamps.

Source code in python/toolr/utils/_logs.py
def include_timestamps() -> bool:
    """
    Return True if any of the configured logging handlers includes timestamps.
    """
    return any(handler.formatter is TIMESTAMP_FORMATTER for handler in logging.root.handlers)