????
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clevents/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clevents/__pycache__/event.cpython-311.opt-1.pyc |
� Ck�e� � �J � d dl mZ d dlZd dlZd dlmZ G d� de� � ZdS )� )�absolute_importN)� format_excc �` � e Zd ZdZdZd� Zed� � � Zd� Ze d� � � Z d� Zd� Zd � 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 � � | _ d S �N)�set� _listeners)�selfs �py/clevents/event.py�__init__zEvent.__init__ s � ��%�%����� c �b � |t j k r | j sd S t j ||� � d S r )�syslog� LOG_DEBUG�WRITE_DEBUG_TO_SYSLOG)�cls�level�messages r �_log_messagezEvent._log_message s7 � � �F�$�$�$�S�-F�$��F�� �e�W�%�%�%�%�%r c �Z � ||i |�� d� |||� � }| � t j |� � dS # t $ r] | � |� � }d� |||t � � � � }| � t j |� � Y dS w xY w)z9Run callable object func and forward exceptions to syslogz0DEBUG: Handler {} notified with params: ({}, {})z�WARNING: An error occurred while notifying handler {} with ({}, {}). Following error raised: {}.Please, contact CloudLinux support if it happens again.N)�formatr r r � BaseException�_get_function_footprintr �LOG_WARNING)r �func�args�kwargsr � footprints r �_run_or_log_exceptionzEvent._run_or_log_exception( s� � � 9��D�$�!�&�!�!�!� I�O�O�PT�VZ�\b�c�c�G����f�.��8�8�8�8�8�� � ;� ;� ;��4�4�T�:�:�I�� �� �4�����F�F� � ���f�0�'�:�:�:�:�:�:� ;���s �A �A#B*�)B*c �&