403Webshell
Server IP : 46.17.175.229  /  Your IP : 216.73.217.138
Web Server : LiteSpeed
System : Linux lt-bnk-web1163.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User : u528038015 ( 528038015)
PHP Version : 8.2.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/fluent/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/fluent/__pycache__/handler.cpython-37.pyc
B

H�me�"�@sxddlZddlZddlZyddlZWnek
r@ddlZYnXddlmZGdd�deje	�Z
Gdd�dej�ZdS)�N)�sendercsveZdZdZd�fdd�	Z�fdd	�Zd
d�Zdd
�Zdd�Z�fdd�Z	dd�Z
dd�Zdd�Ze
dd��Z�ZS)�FluentRecordFormattera7 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�%FTcstt|��d|�tjdd�dkr^|dkr^tjdddd�ftjd	d
dd�fd�|\|_}nd|_d
ddd�}|dk	r�t	|�|_
d|_|j|_
tt|�j|_nRd|_
|s�||_|j|_
|j|_n0t|d�r�||_
|j|_n||_|j|_
|j|_|�r|j|_n|j|_t��|_||_dS)Nr�)�rrz
{hostname}z{name}z{module})Zsys_hostZsys_name�
sys_modulez${hostname}z${name}z	${module})�{�$z%(hostname)sz%(name)sz
%(module)s�__call__)�superr�__init__�sys�version_info�logging�StrFormatStyle�StringTemplateStyle�_FluentRecordFormatter__style�set�
_exc_attrs�	_fmt_dict�_format_by_exclusion�
_formatter�usesTime�_format_by_dict�_format_by_dict_uses_time�hasattr�_format_msg_json�_format_msg�_format_msg_default�socket�gethostname�hostname�fill_missing_fmt_key)�self�fmt�datefmt�styler"Zformat_jsonZ
exclude_attrsZbasic_fmt_dict)�	__class__��?/opt/alt/python37/lib/python3.7/site-packages/fluent/handler.pyr$sH





zFluentRecordFormatter.__init__cs2tt|��|�|j|_|�|�}|�||�|S)N)rr�formatr!r�_structuring)r#�record�data)r'r(r)r*Zs

zFluentRecordFormatter.formatcCsdS)zTThis method is substituted on construction based on settings for performance reasonsNr()r#r(r(r)rfszFluentRecordFormatter.usesTimecCsR|j}t|t�r|�||�n0t|t�r>|�||�||��n|�|d|i�dS)a} Melds `msg` into `data`.

        :param data: dictionary to be sent to fluent server
        :param msg: :class:`LogRecord`'s message to add to `data`.
          `msg` can be a simple string for backward compatibility with
          :mod:`logging` framework, a JSON encoded string or a dictionary
          that will be merged into dictionary generated in :meth:`format.
        �messageN)�msg�
isinstance�dict�_add_dic�strr)r#r-r,r/r(r(r)r+is	

z"FluentRecordFormatter._structuringcCsNy,t�t|��}t|t�r|S|�||�SWntk
rH|�||�SXdS)N)�json�loadsr3r0r1r�
ValueError)r#r,r/Zjson_msgr(r(r)r{s
z&FluentRecordFormatter._format_msg_jsoncsdtt|��|�iS)Nr.)rrr*)r#r,r/)r'r(r)r�sz)FluentRecordFormatter._format_msg_defaultcCs2i}x(|j��D]\}}||jkr|||<qW|S)N)�__dict__�itemsr)r#r,r-�key�valuer(r(r)r�s

z*FluentRecordFormatter._format_by_exclusioncCs�i}xv|j��D]h\}}y&|jr2|�|��|�}n
||j}Wn0tk
rn}zd}|js^|�Wdd}~XYnX|||<qW|S)N)rr8rr*r7�KeyErrorr")r#r,r-r9r:�excr(r(r)r�sz%FluentRecordFormatter._format_by_dictcs0|jr|jj�nd�t�fdd�|j��D��S)Nz
%(asctime)csg|]}|���dk�qS)r)�find)�.0r:)�searchr(r)�
<listcomp>�szCFluentRecordFormatter._format_by_dict_uses_time.<locals>.<listcomp>)r�asctime_search�anyr�values)r#r()r?r)r�s
z/FluentRecordFormatter._format_by_dict_uses_timecCs,x&|��D]\}}t|t�r
|||<q
WdS)N)r8r0r3)r-Zdicr9r:r(r(r)r2�s
zFluentRecordFormatter._add_dic)NNrFTN)�__name__�
__module__�__qualname__�__doc__rr*rr+rrrrr�staticmethodr2�
__classcell__r(r()r'r)rs5
rcs^eZdZdZddd�Zd	d
�Zedd��Zd
d�Zdd�Z	�fdd�Z
dd�Zdd�Z�Z
S)�
FluentHandlerz%
    Logging Handler for fluent.
    �	localhost�^�@FNc	
KsL||_||_||_||_||_||_||_||_|	|_d|_	t
j�|�dS)N)
�tag�_host�_port�_timeout�_verbose�_buffer_overflow_handler�_msgpack_kwargs�_nanosecond_precision�_kwargs�_senderr�Handlerr)
r#rN�host�port�timeout�verbose�buffer_overflow_handler�msgpack_kwargs�nanosecond_precision�kwargsr(r(r)r�szFluentHandler.__init__cCstjS)N)rZFluentSender)r#r(r(r)�getSenderClass�szFluentHandler.getSenderClasscCsF|jdkr@|jf|j|j|j|j|j|j|j|j	d�|j
��|_|jS)N)rNrYrZr[r\r]r^r_)rW�getSenderInstancerNrOrPrQrRrSrTrUrV)r#r(r(r)r�s
zFluentHandler.senderc	
Ks(|��}
|
|f|||||||d�|	��S)N)rYrZr[r\r]r^r_)ra)r#rNrYrZr[r\r]r^r_r`Zsender_classr(r(r)rb�szFluentHandler.getSenderInstancecCs6|�|�}|j}|�d|jr(t�|j�nt|j�|�S)N)r*rZemit_with_timer_Z	EventTime�created�int)r#r,r-rWr(r(r)�emit�s
zFluentHandler.emitc	s<|��z$z|j��Wdtt|���XWd|��XdS)N)�acquirer�closerrJ�release)r#)r'r(r)rg�szFluentHandler.closecCs|S)Nr()r#r(r(r)�	__enter__�szFluentHandler.__enter__cCs|��dS)N)rg)r#�exc_type�exc_val�exc_tbr(r(r)�__exit__�szFluentHandler.__exit__)rKrLrMFNNF)rDrErFrGrra�propertyrrbrergrirmrIr(r()r'r)rJ�s
	
rJ)
rrr
Z
simplejsonr4�ImportErrorZfluentr�	Formatter�objectrrXrJr(r(r(r)�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit