Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/lvestats/lib/commons/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/lvestats/lib/commons/__pycache__/logsetup.cpython-311.pyc

�

)�f�����ddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZej
ejejejejd�Zdadadadadejdfd	�Zd
�Zd�Zd�Zd
�Zd�ZdS)�)�absolute_importN)�
SysLogHandler)�breadcrumbs)�
SentryHandler)�LveStatsSentryFilter�init_sentry_client)�debug�info�warning�error�critical�lvestatsc��tj�tj��t	|��t��t
t||����t|��tj	|��S)z�
    Sets up logging
    :param dict|None config: pass None if config wasn't initialized yet, then don't use it.
    :param str caller_name:
    :param console_level:
    :param file_level:
    :return logging.Logger: log, initialized
    )
�logging�root�setLevel�DEBUG�init_console_log�init_syslog�
init_file_log�get_file_logging_level�init_sentry_handler�	getLogger)�config�caller_name�
console_level�
file_levels    ��/builddir/build/BUILDROOT/lve-stats-4.2.8-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/commons/logsetup.py�
setup_loggingr sk���L���'�-�(�(�(��]�#�#�#��M�M�M��(���<�<�=�=�=��������[�)�)�)�c�`�	t��tdtj���atj�t��tjd���}t�|��t�tj	��dSdS#t$rYdSwxYw)Nz/dev/log)�address�facilityz1lve-stats: (%(name)s) [%(levelname)s] %(message)s��fmt)�SYS_LOGr�
LOG_DAEMONrr�
addHandler�	Formatter�setFormatterr�ERROR�	Exception)�
formatter_syss rrr3s���	
��?�#�J��AY�Z�Z�Z�G��L�#�#�G�,�,�,�#�-�2e�f�f�f�M�� � ��/�/�/����W�]�+�+�+�+�+��?���
�
�
����
���s�BB�
B-�,B-c�:�d}	t��tj�|��sJtjd��}t|d�����tj|��tj|d��tj	|��atj
�t��tjd���}t�
|��t�|��dS#t$rYdSwxYw)Nz/var/log/lve-stats.log�?�wi�z3%(asctime)s: (%(name)s) [%(levelname)s] %(message)sr$)�FILE_LOG�os�path�lexists�umask�open�close�chmodr�FileHandlerrr(r)r*rr,)r�
log_file_name�umask_saved�	formatters    rrr@s���,�M�
����7�?�?�=�1�1�
&� �h�t�n�n���]�C�(�(�.�.�0�0�0����%�%�%��H�]�E�*�*�*��*�=�9�9�H��L�#�#�H�-�-�-��)�.c�d�d�d�I��!�!�)�,�,�,����*�%�%�%�%�%���
�
�
����
���s�DD�
D�Dc��	t��dD]"}tj|tj����#t��}t
|��at��}t�|��|j	�|��tj
�t��t�tj
��trg|rgdtjjvrV|�dd��tjjd<|�dd��tjjd<dSdSdSdS#t"$rYdSwxYw)z
    :param dict config:
    N)zsqlalchemy.pool.NullPoolzmain_loop.plugin_executorzsqlalchemy.orm.mapper.Mapper)�allow_level�db_type�None�	server_id)�
SENTRY_LOGr�
ignore_loggerr�WARNINGrrr�	addFilter�uncaught_loggerrr(rr+�client�tags�getr,)r�logger_namerG�
sentry_filters    rrrSs]��
��� @�
T�
T���)�+�7�?�S�S�S�S�S�'�)�)�F�&�v�.�.�J�0�2�2�M�� � ��/�/�/��"�,�,�]�;�;�;��L�#�#�J�/�/�/�����
�.�.�.��	R�&�	R�Y�j�6G�6L�%L�%L�06�
�
�9�f�0M�0M�J��"�9�-�28�*�*�[�&�2Q�2Q�J��"�;�/�/�/�	R�	R�	R�	R�%L�%L���
�
�
����
���s�D?E	�	
E�Ec�F�|��|r�|�dd�����}|r@|tvr7tjd|zdzt|��z��tj}n2t�|tj��}ntj}|S)N�
logging_levelr
zUnknown log level: z. File logging level is set to )rI�lower�LOGGING_LEVELSrr�str�INFO�CRITICAL)rrrMs   rrrms������		*�"�J�J���?�?�E�E�G�G�M��
M��n�!D�!D���)�M�9�<]�]�`c�dn�`o�`o�o�q�q�q�$�\�
�
�+�/�/�
�w�|�L�L�
�
� �)�J��r c��t�ftj��atj�t��tjd���}t�|��t�|��dS)Nz&%(levelname)s : (%(name)s) %(message)sr$)�CONSOLE_LOGr�
StreamHandlerrr(r)r*r)r�formatter_consoles  rrr|sp�����+�-�-�������,�,�,�#�-�2Z�[�[�[��� � �!2�3�3�3�����'�'�'�'�'r )�
__future__rrr2�logging.handlersr�ravenr�raven.handlers.loggingr�lvestats.lib.commons.sentryrrrrQrDr+rRrOrTr&r1rBrrrrrr�r r�<module>r]s-��'�&�&�&�&�&�����	�	�	�	�*�*�*�*�*�*�������0�0�0�0�0�0�P�P�P�P�P�P�P�P��]��L���
�]�� ������
����
�
�'1� '�
�!�*�*�*�*�&

�

�

�
�
�
�&
�
�
�4���(�(�(�(�(r 

Hacked By AnonymousFox1.0, Coded By AnonymousFox