Пример #1
0
    def format(self, record: LogRecord) -> str:
        record.correlation_id = mdc.correlation_id.get()
        record.trace_id = mdc.trace_id.get()
        record.level = record.levelname

        record.name = f'{_project_name}.{record.name}' if _project_name else record.name

        return super().format(record)
Пример #2
0
    def format(self, record: LogRecord) -> str:
        record.message_id = mdc.message_id.get()
        record.correlation_id = mdc.correlation_id.get()
        record.inbound_message_id = mdc.inbound_message_id.get()
        record.interaction_id = mdc.interaction_id.get()

        record.name = f'{_project_name}.{record.name}' if _project_name else record.name

        return super().format(record)
Пример #3
0
    def filter(self, record: LogRecord) -> bool:
        """
        Determines that the specified record is to be logged.

        From the docs:
                Is the specified record to be logged? Returns 0 for no, nonzero for
                yes. If deemed appropriate, the record may be modified in-place.
        :param record: Log record
        :return: True
        """
        record.correlation_id = GuidMiddleware.get_guid()
        return True