Hacked By AnonymousFox
�
)�f� � �� � d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z d dl
mZmZ ej
ej ej ej ej d�Zdadadadadej dfd �Zd
� Zd� Zd� Zd
� Zd� ZdS )� )�absolute_importN)�
SysLogHandler)�breadcrumbs)�
SentryHandler)�LveStatsSentryFilter�init_sentry_client)�debug�info�warning�error�critical�lvestatsc � � t j � t j � � t |� � t � � t
t | |� � � � t | � � t j |� � 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 ��t dt j �� � a t j � t � � t j d�� � } t � | � � t � t j � � d S d S # t $ r Y d S w xY w)Nz/dev/log)�address�facilityz1lve-stats: (%(name)s) [%(levelname)s] %(message)s��fmt)�SYS_LOGr �
LOG_DAEMONr r �
addHandler� Formatter�setFormatterr �ERROR� Exception)�
formatter_syss r r r 3 s� � �
��?�#�J��AY�Z�Z�Z�G��L�#�#�G�,�,�,�#�-�2e�f�f�f�M�� � ��/�/�/����W�]�+�+�+�+�+� �?�� �
�
�
����
���s �BB �
B-�,B-c �: � d} t ��t j � |� � sJt j d� � }t |d� � � � � t j |� � t j |d� � t j |� � a t j
� t � � t j d�� � }t �
|� � t � | � � d S # t $ r Y d S w xY w)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 �FileHandlerr r( r) r* r r, )r �
log_file_name�umask_saved� formatters r r r @ 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 ]"}t j |t j �� � �#t � � }t
|� � a t � � }t � |� � |j � |� � t j
� t � � t � t j
� � t rg| rgdt j j vrV| � dd� � t j j d<