AlkantarClanX12

Your IP : 3.144.40.216


Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/handlers/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/handlers/__pycache__/logging.cpython-37.pyc

B

��Yp�@s�dZddlmZddlmZddlZddlZddlZddlZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZed	�Zefd
d�ZGdd
�d
eje�ZdS)z�
raven.handlers.logging
~~~~~~~~~~~~~~~~~~~~~~

: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�	iteritems�	text_type)�Client)�	to_string)�iter_stack_frames)�stack�name�module�funcName�args�msg�levelno�exc_text�exc_info�data�created�	levelname�msecs�relativeCreated�tags�messagecCs�i}t|dd�}t|t�s,|r(d|i}ni}xPtt|��D]@\}}||krLq:|�d�rXq:d|krr|dkrr|||<q:|||<q:W||fS)Nr�_�.)ZculpritZserver_nameZfingerprint)�getattr�
isinstance�dictr�vars�
startswith)�record�reservedr�extra�k�v�r&�G/opt/alt/python37/lib/python3.7/site-packages/raven/handlers/logging.py�
extract_extras



r(c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
SentryHandlercOs�|�dt�}t|�dkrh|d}t|t�r@|fd|i|��|_q�t|t�rR||_q�td|jj|f��n d|kr||d|_n|||�|_|�	dd�|_
tjj
||�dtj�d	�dS)
NZ
client_cls�rZdsnzSThe first argument to %s must be either a Client instance or a DSN, got %r instead.�clientr�level)r,)�getr�lenrrr+�
ValueError�	__class__�__name__�popr�logging�Handler�__init__�NOTSET)�selfr�kwargsr+�argr&r&r'r55s

zSentryHandler.__init__cCs|jdkp|j�d�S)N�raven)z
sentry.errorszraven.)rr )r7r!r&r&r'�
can_recordJs
zSentryHandler.can_recordcCs�y6|�|�|�|�s.tt|j�tjd�dS|�|�Stk
r�|j	j
rP�tdtjd�tt|j�tjd�ttt�
��tjd�YnXdS)N)�filez>Top level Sentry exception caught - failed creating log record)�formatr;�printrr�sys�stderr�_emit�	Exceptionr+Zraise_send_errorsr�	traceback�
format_exc)r7r!r&r&r'�emitPs



zSentryHandler.emitcCs�t|�}g}d}d}x~|D]v}t|ttf�r6|\}}n||j}}|s�t|di�}	|	�dd�}
|r||�d�r||
�d�s|d}n|
}q|�||f�qW|s�|S|S)NF��	f_globalsr1r3T)�listr�tuple�f_linenorr-r �append)r7r
r!�frames�startedZlast_mod�item�frame�linenorG�module_namer&r&r'�_get_targetted_stackbs(


z"SentryHandler._get_targetted_stackcKs�t|�\}}t|dd�}|dkr&t�}|r6|�||�}tj�|j�}d}d|ji}yt|j	�|d<Wn*t
k
r�t|j	�dd�|d<YnXyt|j�|d<Wn*t
k
r�t|j�dd�|d<YnX|j
�rt|j
��r|j�|�}	|�|	jf|��d	}d
|j
i}|j|d<|j|d<i|d
<}
|j�rB|
�|j�|
�t|d
i��|�|�|�dd�}|jj|f|||||d�|��S)Nr
Tzraven.events.Message�paramsrr*����	formattedzraven.events.Exceptionrr,�loggerr�sample_rate)r
rr#�daterW)r(rr	rR�datetime�utcfromtimestamprrrr�UnicodeDecodeError�reprrr�allr+Zget_handler�update�capturerrrr2)r7r!r8rr#r
rXZ
event_typeZhandler_kwargs�handlerrrWr&r&r'rA�sD





zSentryHandler._emitN)r1�
__module__�__qualname__r5r;rErRrAr&r&r&r'r)4s
r))�__doc__�
__future__rrrYr3r?rCZraven.utils.compatrrrZ
raven.baserZraven.utils.encodingrZraven.utils.stacksr	�	frozensetZRESERVEDr(r4�objectr)r&r&r&r'�<module>s