← Back
Editing: _format.cpython-38.pyc
U \�[�0 � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZm Z d Zd d� Zdd � Zedfdd�Zefdd�ZG dd� de�Zdd� Zdd� Zdd� Zdd� Zdddefdd�Zd S )!z& Tools for formatting logging events. � )�datetime)�unicode)�Failure)� safe_repr)�FixedOffsetTimeZone� )� flatFormat� aFormatterz%Y-%m-%dT%H:%M:%S%zc C s t | dddd�S )� Formats an event as a L{unicode}, 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. @type event: L{dict} @return: A formatted string. @rtype: L{unicode} F)�includeTraceback�includeTimestamp� includeSystem)�eventAsText)�event� r �8/usr/lib/python3/dist-packages/twisted/logger/_format.py�formatEvent s �r c C s\ zdj | |d�W S tk rV t� }d�dd� | �� D ��}dj t|�||d� Y S X dS ) a( Formats an event as a L{unicode} that describes the event generically and a formatting error. @param event: A logging event. @type event: L{dict} @param error: The formatting error. @type error: L{Exception} @return: A formatted string. @rtype: L{unicode} z)Unable to format event {event!r}: {error})r �errorz, c s s( | ] \}}d � t|�t|�f�V qdS )z = N)�joinr )�.0�key�valuer r r � <genexpr>I s �z+formatUnformattableEvent.<locals>.<genexpr>zrMESSAGE LOST: unformattable object logged: {error} Recoverable data: {text} Exception during formatting: {failure})r �failure�textN)�format� BaseExceptionr r �itemsr )r r r r r r r �formatUnformattableEvent. s"