Your IP : 3.139.239.25
B
��Y� � @ sn d Z ddlmZ ddlmZ ddlZddlZddlZddlmZ ddl m
Z
ddlmZ G dd � d ej
�ZdS )
z�
raven.handlers.logbook
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
� )�absolute_import)�print_functionN)�string_types)�Client)� to_stringc s, e Zd Z� fdd�Zdd� Zdd� Z� ZS )�
SentryHandlerc s� t |�dkrh|d }t|t�r<|�dt�f d|i|��| _n&t|t�rN|| _ntd| jj|f ��g }n.y|�d�| _W n t k
r� t
d��Y nX tt| �j
||� d S )N� r Z
client_clsZdsnzSThe first argument to %s must be either a Client instance or a DSN, got %r instead.�clientz3Expected keyword argument for SentryHandler: client)�len�
isinstancer �popr r �
ValueError� __class__�__name__�KeyError� TypeError�superr �__init__)�self�args�kwargs�arg)r � �G/opt/alt/python37/lib/python3.7/site-packages/raven/handlers/logbook.pyr s
zSentryHandler.__init__c C s� y2|j �d�r*tt| �|��tjd� d S | �|�S tk
r� | j j
rL� tdtjd� tt|j�tjd� ttt�
� �� y| j �� W n tk
r� Y nX Y nX d S )N)z
sentry.errors�raven)�filez>Top level Sentry exception caught - failed creating log record)�channel�
startswith�printr �format�sys�stderr�_emit� Exceptionr Zraise_send_errors�msg� traceback�
format_excZcaptureException)r �recordr r r �emit* s
zSentryHandler.emitc C s� t �|j��� |jd�}d}|j|j| �|�d�}d|jkrJ|jd |d<