LoggerOnce
Index
Methods
__init__
Parameters
logger: logging.Logger
Returns None
log
Log
messageatlevelthe first timekeyis seen on this instance; later calls are no-ops.Parameters
message: str
The message to log.
keyword-onlykey: str
Deduplication key. Two calls with the same key emit at most once.
optionalkeyword-onlylevel: int = logging.INFO
Standard
logginglevel (e.g.logging.WARNING). Defaults tologging.INFO.
Returns None
Emits each log message at most once, keyed by an explicit string.
Useful for diagnostic warnings that would otherwise spam the log when the same condition recurs (per-request misconfiguration warnings, repeated fallback paths, etc.). Deduplication scope follows the lifetime of the instance — a module-level instance gives process-wide dedup; an attribute on a class gives per-instance dedup.