관리-도구
편집 파일: loguru.cpython-38.pyc
U �Mg� � @ s d dl Z d dlmZmZ d dlmZmZmZ d dlm Z e rXd dl mZ d dlmZm Z z$d dlZd dlmZ d dlmZ W n ek r� ed ��Y nX G d d� de j�ZejjZejjZdaG d d� de�ZG dd� de�ZG dd� dee�ZG dd� dee�ZdS )� N)�Integration�DidNotEnable)�BreadcrumbHandler�EventHandler�_BaseHandler)� TYPE_CHECKING)� LogRecord)�Optional�Tuple)�logger)� LOGURU_FORMATzLOGURU is not installedc @ s( e Zd ZdZdZdZdZdZdZdZ dS ) � LoggingLevels� � � � � �( �2 N) �__name__� __module__�__qualname__�TRACE�DEBUG�INFO�SUCCESS�WARNING�ERROR�CRITICAL� r r �L/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/loguru.pyr s r )NNc @ s. e Zd ZdZeeeefdd�Zedd� �Z dS )�LoguruIntegration�loguruc C s| t \}}|d k rt�|� d }|d k r4t�|� d }|d k rRtjt|d�||d�}|d k rptjt|d�||d�}||fa d S )N)�level)r# �format)�_ADDED_HANDLERSr �remove�add�LoguruBreadcrumbHandler�LoguruEventHandler)�selfr# Zevent_levelZbreadcrumb_formatZevent_formatZbreadcrumb_handlerZ event_handlerr r r �__init__. s( ��zLoguruIntegration.__init__c C s d S )Nr r r r r � setup_onceP s zLoguruIntegration.setup_onceN) r r r � identifier� DEFAULT_LEVEL�DEFAULT_EVENT_LEVEL�DEFAULT_FORMATr+ �staticmethodr, r r r r r! + s � "r! c @ s e Zd Zdd� ZdS )�_LoguruBaseHandlerc C s@ zt |j�j�� W S tk r: |jr2|j�� nd Y S X d S )N� )r �levelno�name�lower� ValueError� levelname)r* �recordr r r �_logging_to_event_levelW s z*_LoguruBaseHandler._logging_to_event_levelN)r r r r: r r r r r2 V s r2 c @ s e Zd ZdZdS )r) zfModified version of :class:`sentry_sdk.integrations.logging.EventHandler` to use loguru's level names.N�r r r �__doc__r r r r r) _ s r) c @ s e Zd ZdZdS )r( zkModified version of :class:`sentry_sdk.integrations.logging.BreadcrumbHandler` to use loguru's level names.Nr; r r r r r( c s r( ) �enumZsentry_sdk.integrationsr r Zsentry_sdk.integrations.loggingr r r �typingr �loggingr r r r"