ExtendedFilter faststream.log.logging.ExtendedFilter # ExtendedFilter(default_context, message_id_ln, name='') Bases: Filter Source code in faststream/log/logging.py 23 24 25 26 27 28 29 30 31def __init__( self, default_context: Mapping[str, str], message_id_ln: int, name: str = "", ) -> None: self.default_context = default_context self.message_id_ln = message_id_ln super().__init__(name) default_context instance-attribute # default_context = default_context message_id_ln instance-attribute # message_id_ln = message_id_ln filter # filter(record) Source code in faststream/log/logging.py 33 34 35 36 37 38 39 40 41 42 43 44 45def filter(self, record: LogRecord) -> bool: if is_suitable := super().filter(record): log_context: Mapping[str, str] = context.get_local( "log_context", self.default_context ) for k, v in log_context.items(): value = getattr(record, k, v) setattr(record, k, value) record.message_id = getattr(record, "message_id", "")[: self.message_id_ln] return is_suitable