Current File : //proc/self/root/lib/python3/dist-packages/twisted/logger/__pycache__/_format.cpython-312.pyc |
�
Ϫ�f�4 � �\ � d Z ddlmZ ddlmZ ddlmZmZmZm Z m
Z
mZmZ ddl
mZ ddlmZ ddlmZ ddlmZ d d
lmZmZ d dlmZ dZdd
�Zdd�Zedf d d�Zef d!d�Zd"d�Z G d� de � Z! G d� de e"ef � Z#d#d�Z$dd�Z%d$d�Z&dd�Z'dddef d%d�Z(y)&z&
Tools for formatting logging events.
� )�annotations)�datetime)�Any�Callable�Iterator�Mapping�Optional�Union�cast)�
NamedConstant)�FixedOffsetTimeZone)�Failure)� safe_repr� )�
aFormatter�
flatFormat)�LogEventz%Y-%m-%dT%H:%M:%S%zc � � t | ddd�� S )aa
Formats an event as text, using the format in C{event["log_format"]}.
This implementation should never raise an exception; if the formatting
cannot be done, the returned string will describe the event generically so
that a useful message is emitted regardless.
@param event: A logging event.
@return: A formatted string.
F)�includeTraceback�includeTimestamp�
includeSystem)�eventAsText)�events �8/usr/lib/python3/dist-packages/twisted/logger/_format.py�formatEventr s � � �
���� � � c �� � dj | |�� S # t $ rP t � }dj d� | j � D � � }dj t |� ||�� cY S w xY w)z�
Formats an event as text that describes the event generically and a
formatting error.
@param event: A logging event.
@param error: The formatting error.
@return: A formatted string.
z)Unable to format event {event!r}: {error})r �errorz, c 3 �l K � | ], \ }}d j t |� t |� f� �� �. y�w)z = N)�joinr )�.0�key�values r � <genexpr>z+formatUnformattableEvent.<locals>.<genexpr>C s3 � �� �
���U�
�J�J� �#�� �%�(8�9�:�
�s �24zrMESSAGE LOST: unformattable object logged: {error}
Recoverable data: {text}
Exception during formatting:
{failure})r �failure�text)�format�
BaseExceptionr r �itemsr )r r r% r&