def format(self, record: logging.LogRecord) -> str: if not hasattr(record, "account"): record.account = _account_log_context # type: ignore result = logging.Formatter.format(self, record) return result
def prepare(self, record: logging.LogRecord) -> logging.LogRecord: """Override method to include account log-context from sub-process.""" if not hasattr(record, "account"): record.account = _account_log_context # type: ignore return super().prepare(record) # type: ignore