thinlog.filters.assigner module

thinlog.filters.assigner module#

Assigner filter – conditionally attach attributes to log records.

class thinlog.filters.assigner.AssignerFilter(assignments: dict[str, Any], **kwargs: Any)[source]#

Bases: WhitelistFilter

Assign attributes to matching records without blocking any.

Extends WhitelistFilter – if a record matches the whitelist criteria, the assignments dict is applied to the record as attributes. The filter always returns True so no records are dropped.

Parameters:

assignments – Mapping of attribute names to values that will be set on matching records via setattr().

filter(record: LogRecord) bool[source]#

Apply assignments if the record matches, then always return True.