File: //opt/alt/python311/lib/python3.11/site-packages/fluent/__pycache__/handler.cpython-311.pyc
�
��;f�! � �v � d dl Z d dlZd dlZd dlmZ G d� dej � � Z G d� dej � � ZdS )� N)�senderc �~ � � e Zd ZdZ d� fd� Z� fd�Zd� Zd � Zd
� Z� fd�Z d� Z
d
� Zd� Ze
d� � � Z� xZS )�FluentRecordFormattera6 A structured formatter for Fluent.
Best used with server storing data in an ElasticSearch cluster for example.
:param fmt: a dict or a callable with format string as values to map to provided keys.
If callable, should accept a single argument `LogRecord` and return a dict,
and have a field `usesTime` that is callable and return a bool as would
`FluentRecordFormatter.usesTime`
:param datefmt: strftime()-compatible date/time format string.
:param style: '%', '{' or '$' (used only with Python 3.2 or above)
:param fill_missing_fmt_key: if True, do not raise a KeyError if the format
key is not found. Put None if not found.
:param format_json: if True, will attempt to parse message as json. If not,
will use message as-is. Defaults to True
:param exclude_attrs: switches this formatter into a mode where all attributes
except the ones specified by `exclude_attrs` are logged with the record as is.
If `None`, operates as before, otherwise `fmt` is ignored.
Can be an iterable.
N�%FTc � �� t � � � d |� � |dk r4t j dddd�ft j dddd�fd �| \ | _ }n
d | _ d
ddd�}|�@t
|� � | _ d | _ | j | _
t � � j | _ nkd | _ |s || _ | j | _
| j
| _ nBt |� � r|| _
|j | _ n|| _ | j | _
| j
| _ |r
| j | _ n| j | _ t% j � � | _ || _ d S )
Nr z
{hostname}z{name}z{module})�sys_host�sys_name�
sys_modulez${hostname}z${name}z ${module})�{�$z%(hostname)sz%(name)sz
%(module)s)�super�__init__�logging�StrFormatStyle�StringTemplateStyle�_FluentRecordFormatter__style�set�
_exc_attrs� _fmt_dict�_format_by_exclusion�
_formatter�usesTime�_format_by_dict�_format_by_dict_uses_time�callable�_format_msg_json�_format_msg�_format_msg_default�socket�gethostname�hostname�fill_missing_fmt_key) �self�fmt�datefmt�styler"