AlkantarClanX12

Your IP : 3.15.239.145


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clevents/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/clevents/__pycache__/event.cpython-311.pyc

�

�ugk��<�ddlZddlZddlmZGd�d��ZdS)�N)�
format_excc�`�eZdZdZdZd�Zed���Zd�Ze	d���Z
d�Zd�Zd	�Z
d
S)�Eventa�
    Event is an object that can have several listeners.
    Register new handler using '.register()' method.
    When you call '.throw_event(*a, **kw)' , class notifies all registered listeners.

    This class is logging his actions to syslog.
    Exceptions happened in hooks are logged as warnings, all
    other messages have debug level. For debug purposes you can
    manually change syslog level in /etc/rsyslog.conf file.
    Fc�,�t��|_dS�N)�set�
_listeners)�selfs �E/opt/cloudlinux/venv/lib64/python3.11/site-packages/clevents/event.py�__init__zEvent.__init__s���%�%�����c�b�|tjkr	|jsdStj||��dSr)�syslog�	LOG_DEBUG�WRITE_DEBUG_TO_SYSLOG)�cls�level�messages   r�_log_messagezEvent._log_message s7���F�$�$�$�S�-F�$��F��
�e�W�%�%�%�%�%r
c
�2�	||i|��d|�d|�d|�d�}|�tj|��d	S#t$rT|�|��}d|�d|�d|�dt���d�	}|�tj|��Yd	SwxYw)
z9Run callable object func and forward exceptions to syslogzDEBUG: Handler z notified with params: (z, �)z3WARNING: An error occurred while notifying handler z with (z). Following error raised: z8.Please, contact CloudLinux support if it happens again.N)rrr�
BaseException�_get_function_footprintr�LOG_WARNING)r
�func�args�kwargsr�	footprints      r�_run_or_log_exceptionzEvent._run_or_log_exception(s��	9��D�$�!�&�!�!�!�X��W�W�d�W�W�f�W�W�W�G����f�.��8�8�8�8�8���	;�	;�	;��4�4�T�:�:�I�J��J�J�%)�J�J�-3�J�J�PZ�P\�P\�J�J�J�
�

���f�0�'�:�:�:�:�:�:�	;���s�8�AB�Bc�&�|jdz|jzS)N�:)�__name__�
__module__)rs rrzEvent._get_function_footprint9s���}�s�"�T�_�4�4r
c��|j�|��|�tjd|�|���d���|S)NzDEBUG: Registered new handler �.)r	�addrrrr�r
rs  r�registerzEvent.register?sY������D�!�!�!������R�T�-I�-I�$�-O�-O�R�R�R�	
�	
�	
��r
c��||jvr|j�|��|�tjd|�|���d���dS)NzDEBUG: Unregister handler r%)r	�removerrrrr's  r�
unregisterzEvent.unregisterJsi���4�?�"�"��O�"�"�4�(�(�(������N��)E�)E�d�)K�)K�N�N�N�	
�	
�	
�	
�	
r
c�<�|jD]}|j|g|�Ri|���dSr)r	r)r
rrrs    r�throw_eventzEvent.throw_eventSsC���O�	>�	>�D�&�D�&�t�=�d�=�=�=�f�=�=�=�=�	>�	>r
N)r"r#�__qualname__�__doc__rr�classmethodrr�staticmethodrr(r+r-�r
rrrs�������	�	�"�� � � ��&�&��[�&�9�9�9�"�5�5��\�5�
	�	�	�
�
�
�>�>�>�>�>r
r)r�types�	tracebackrrr2r
r�<module>r5sg���
�
�
����� � � � � � �H>�H>�H>�H>�H>�H>�H>�H>�H>�H>r