B YA@sdZddlmZddlZddlZddlmZddlmZm Z dZ Gddde Z e ed rdd d Znd d ZGd dde ZGddde ZGddde ZdS)z raven.events ~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. )absolute_importN) to_unicode)get_stack_infoiter_traceback_frames) BaseEvent ExceptionMessageQueryc@s,eZdZddZddZddZddZd S) rcCs||_tt|_dS)N)clientlogging getLogger__name__logger)selfr r=/opt/alt/python37/lib/python3.7/site-packages/raven/events.py__init__szBaseEvent.__init__cCstdS)N)NotImplementedError)rdatarrr to_stringszBaseEvent.to_stringcKsiS)Nr)rkwargsrrrcaptureszBaseEvent.capturecCs |j|S)N)r transform)rvaluerrrr szBaseEvent.transformN)r __module__ __qualname__rrrrrrrrrsr__suppress_context__ccsn|V|\}}}t}||xH|jr0|j}n|j}||kr@P|||dkrTPt|||jfVq"WdS)z Return a generator iterator over an exception's chain. The exceptions are yielded from outermost to innermost (i.e. last to first when viewing a stack trace). N)setaddr __cause__ __context__type __traceback__)exc_infoexc_typeexc exc_tracebackcontextrrr_chained_exceptions(s   r(ccs |VdS)Nr)r#rrrr(Csc@s.eZdZdZdZddZddZd dd ZdS) rz Exceptions store the following metadata: - value: 'My exception value' - type: 'ClassName' - module '__builtin__' (i.e. __builtin__.TypeError) - frames: a list of serialized frames (see _get_traceback_frames) exceptioncCs6||jdd}|dr.d|d|dfS|dS)Nvaluesrz%s: %sr!)name)rrr%rrrrTszException.to_stringcCsVtt||j|jjd}t|dd}|r0t|}t|dd}t|t|t||dS)zH Convert exception info to a value for the values list. )Z transformercapture_localsrNr z )rr!moduleZ stacktrace)rrrr r-getattrstrr)rr$ exc_valuer& stack_infoZ exc_modulerrr _get_valueZs   zException._get_valueNcKsh|r |dkrt}|s tdg}x&t|D]}|j|}|d|q.Wd|dtj|j d|iiS)NTzNo exception foundrlevelr*) sysr# ValueErrorr(r3insertgetr ERRORr,)rr#rr*rrrrrps  zException.capture)N)r rr__doc__r,rr3rrrrrrGs  rc@s&eZdZdZdZddZd ddZdS) rz{ Messages store the following metadata: - message: 'My message from %s about %s' - params: ('foo', 'bar') zsentry.interfaces.MessagecCs||jdS)Nmessage)r,)rrrrrrszMessage.to_stringrNcKs8t|}|j||||di}d|kr4|p.||d<|S)N)r;params formattedr;)rr,r)rr;r<r=rrrrrrs  zMessage.capture)rN)r rrr:r,rrrrrrrsrc@s$eZdZdZdZddZddZdS)r zw Messages store the following metadata: - query: 'SELECT * FROM table' - engine: 'postgesql_psycopg2' zsentry.interfaces.QuerycCs||j}|dS)Nquery)r,)rrZsqlrrrrs zQuery.to_stringcKs|jt|t|diS)N)r>engine)r,rr0)rr>r?rrrrrsz Query.captureN)r rrr:r,rrrrrrr sr )r: __future__rr r5Zraven.utils.encodingrZraven.utils.stacksrr__all__objectrhasattrrr(rr rrrrs    ;