%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clevents/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clevents/__pycache__/event.cpython-37.pyc

B

�2Lb��@s<ddlmZddlZddlZddlmZGdd�de�ZdS)�)�absolute_importN)�
format_excc@sTeZdZdZdZdd�Zedd��Zdd�Ze	d	d
��Z
dd�Zd
d�Zdd�Z
dS)�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.
    FcCst�|_dS)N)�set�
_listeners)�self�r�?/opt/alt/python37/lib/python3.7/site-packages/clevents/event.py�__init__szEvent.__init__cCs$|tjkr|jsdSt�||�dS)N)�syslog�	LOG_DEBUG�WRITE_DEBUG_TO_SYSLOG)�cls�level�messagerrr	�_log_message szEvent._log_messagec	Osny|||�Wn>tk
rL|�|�}d�|||t��}|�tj|�YnXd�|||�}|�tj|�dS)z9Run callable object func and forward exceptions to syslogz�WARNING: An error occurred while notifying handler {} with ({}, {}). Following error raised: {}.Please, contact CloudLinux support if it happens again.z0DEBUG: Handler {} notified with params: ({}, {})N)�
BaseException�_get_function_footprint�formatrrrZLOG_WARNINGr)r�func�args�kwargsZ	footprintrrrr	�_run_or_log_exception(s
zEvent._run_or_log_exceptioncCs|jd|jS)N�:)�__name__�
__module__)rrrr	r8szEvent._get_function_footprintcCs*|j�|�|�tjd�|�|���|S)Nz!DEBUG: Registered new handler {}.)r�addrrrrr)rrrrr	�register>szEvent.registercCs4||jkr|j�|�|�tjd�|�|���dS)NzDEBUG: Unregister handler {}.)r�removerrrrr)rrrrr	�
unregisterGs
zEvent.unregistercOs&x |jD]}|j|f|�|�qWdS)N)rr)rrrrrrr	�throw_eventNszEvent.throw_eventN)rr�__qualname__�__doc__r
r
�classmethodrr�staticmethodrrrr rrrr	rs
	r)Z
__future__rr�types�	tracebackr�objectrrrrr	�<module>s

Zerion Mini Shell 1.0