
    ghQ6                        S SK r S SKrS SKJrJr  S SKJr  S SKrS SKJr  S SKJ	r	  S SK
JrJrJrJrJrJr  S SKJr  S SKJr  \(       a  S S	KJr  S S
K Jr  S SKJr  S SKJr  S SKJr  \ R6                  r\ R:                  r\ R>                  S\ R@                  S\ R6                  S\ RB                  S\ RD                  S\ R:                  S\ RF                  S\ RH                  S0r%\ RH                  S\ R:                  S\ RD                  S\ R6                  S\ R@                  S0r&\'" / SQ5      r(S r) " S S\5      r* " S S\ RV                  5      r, " S S \,5      r-\-r. " S! S"\,5      r/ " S# S$\,5      r0g)%    N)datetimetimezone)fnmatch)
BaseClient)_log_level_to_otel)	safe_repr	to_stringevent_from_exceptioncurrent_stacktracecapture_internal_exceptionshas_logs_enabled)Integration)TYPE_CHECKING)MutableMapping)	LogRecord)Any)Dict)Optionalnotsetdebuginfowarningerrorfatal         	      )zsentry_sdk.errorszurllib3.connectionpoolzurllib3.connectionc                 .    [         R                  U 5        g)ah  This disables recording (both in breadcrumbs and as events) calls to
a logger of a specific name.  Among other uses, many of our integrations
use this to prevent their actions being recorded as breadcrumbs. Exposed
to users as a way to quiet spammy loggers.

:param name: The name of the logger to ignore (same string you would pass to ``logging.getLogger``).
N)_IGNORED_LOGGERSadd)names    b/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sentry_sdk/integrations/logging.pyignore_loggerr%   >   s         c                   >    \ rS rSrSr\\\4S jrS r\	S 5       r
Srg)LoggingIntegrationL   loggingc                     S U l         S U l        S U l        Ub  [        US9U l        Ub  [	        US9U l        Ub  [        US9U l         g g )N)level)_handler_breadcrumb_handler_sentry_logs_handlerBreadcrumbHandlerSentryLogsHandlerEventHandler)selfr,   event_levelsentry_logs_levels       r$   __init__LoggingIntegration.__init__O   sY     #' $(!'8u'ED$((9@Q(RD%"({;DM #r&   c                    U R                   b?  UR                  U R                   R                  :  a  U R                   R                  U5        U R                  b?  UR                  U R                  R                  :  a  U R                  R                  U5        U R
                  bA  UR                  U R
                  R                  :  a  U R
                  R                  U5        g g g N)r-   levelnor,   handler.   r/   r3   records     r$   _handle_record!LoggingIntegration._handle_recordc   s    ==$4==;N;N)NMM  ( $$0$":":"@"@@$$++F3 %%1$";";"A"AA%%,,V4 B 2r&   c                  p   ^ [         R                  R                  mU4S jn U [         R                  l        g )Nc                   > [         n T" X5      Ub]  UR                  R                  5       U;  a>  [        R                  " 5       R                  [        5      nUb  UR                  U5        $ $ $ $ ! Ub]  UR                  R                  5       U;  a>  [        R                  " 5       R                  [        5      nUb  UR                  U5        f f f f = fr9   )r!   r#   strip
sentry_sdk
get_clientget_integrationr(   r>   )r3   r=   ignored_loggersintegrationold_callhandlerss       r$   sentry_patched_callhandlersBLoggingIntegration.setup_once.<locals>.sentry_patched_callhandlersy   s     /O;'5 $/))+?B","7"7"9"I"I*#K #.#226: / C 0O/))+?B","7"7"9"I"I*#K #.#226: / C 0s   A1 1A"C)r*   LoggercallHandlers)rI   rH   s    @r$   
setup_onceLoggingIntegration.setup_oncet   s)     #>>66	;. 'B#r&   )r.   r-   r/   N)__name__
__module____qualname____firstlineno__
identifierDEFAULT_LEVELDEFAULT_EVENT_LEVELr6   r>   staticmethodrM   __static_attributes__ r&   r$   r(   r(   L   s2    J ''	<(5" B Br&   r(   c                   6    \ rS rSr\" S5      rS rS rS rSr	g)_BaseHandler   )argscreatedexc_infoexc_textfilenamefuncName	levelnamer:   linennolinenomessagemodulemsecsmsgr#   pathnameprocessprocessNamerelativeCreatedstacktagstaskNamethread
threadName
stack_infoc                 t    [          H.  n[        UR                  R                  5       U5      (       d  M.    g   g)z'Prevents ignored loggers from recordingFT)r!   r   r#   rB   )r3   r=   loggers      r$   _can_record_BaseHandler._can_record   s0     'Fv{{((*F33 ' r&   c                     [         R                  UR                  UR                  (       a  UR                  R	                  5       5      $ S5      $ )N )LOGGING_TO_EVENT_LEVELgetr:   rb   lowerr<   s     r$   _logging_to_event_level$_BaseHandler._logging_to_event_level   sB    %))NN8H8HF,,224
 	
NP
 	
r&   c                     [        U5      R                  5        VVs0 s HE  u  p#X R                  ;  d  M  [        U[        5      (       a  UR                  S5      (       a  MC  X#_MG     snn$ s  snnf )N_)varsitemsCOMMON_RECORD_ATTRS
isinstancestr
startswith)r3   r=   kvs       r$   _extra_from_record_BaseHandler._extra_from_record   sg     V**,
,000   3''q||C/@ AD,
 	
 
s   A-)A-#A-rX   N)
rO   rP   rQ   rR   	frozensetr   ru   r|   r   rW   rX   r&   r$   rZ   rZ      s!    #	
<

r&   rZ   c                   $    \ rS rSrSrS rS rSrg)r2      z
A logging handler that emits Sentry events for each log record

Note that you do not have to use this class if the logging integration is enabled, which it is by default.
c                     [        5          U R                  U5        U R                  U5      sS S S 5        $ ! , (       d  f       g = fr9   r   format_emitr<   s     r$   emitEventHandler.emit   ,    (*KK::f% +**	   "7
Ac                    U R                  U5      (       d  g [        R                  " 5       nUR                  5       (       d  g UR                  nUR
                  (       a+  UR
                  S   b  [        UR
                  USSS.S9u  pEOhUR
                  (       a  UR
                  S   b  UR                  (       a2  0 n0 n[        5          S[        US   US   S	9S
SS./0US'   S S S 5        O0 n0 nXS'   U R                  U5      nUS;   a  XdS'   UR                  US'   [        R                  S:  a2  UR                  S:X  a"  UR                  S:X  a  UR                  S   nSnOUR                  nUR                  n[!        U5      UR#                  5       US.US'   U R%                  U5      US'   [        R&                  " XES9  g ! , (       d  f       N= f)Nr   r*   T)typehandled)client_options	mechanismvaluesinclude_local_variablesmax_value_length)r   r   F)
stacktracecrashedcurrentthreads
log_record>   r   r   r   r   r   criticalr,   rt   )      zpy.warningsz%srX   )re   	formattedparamslogentryextrahint)ru   rC   rD   	is_activeoptionsr^   r
   rr   r   r   r|   r#   sysversion_inforh   r\   r	   
getMessager   capture_event)	r3   r=   clientr   eventr   r,   re   r   s	            r$   r   EventHandler._emit   s   ''&&(!! ??vq1=.-#,>KE4
 oo&//!"4"<ARARED,.*<8F$=9" 2@@R1S	+ (-'+	$i  /.  ED#\,,V4NN"'N ++h w&},

d"
 kk!nGFjjG[[F !)**,
j 008g  2a /.s   G
GrX   N)rO   rP   rQ   rR   __doc__r   r   rW   rX   r&   r$   r2   r2      s    &J3r&   r2   c                   *    \ rS rSrSrS rS rS rSrg)r0   i(  z
A logging handler that records breadcrumbs for each log record.

Note that you do not have to use this class if the logging integration is enabled, which it is by default.
c                     [        5          U R                  U5        U R                  U5      sS S S 5        $ ! , (       d  f       g = fr9   r   r<   s     r$   r   BreadcrumbHandler.emit/  r   r   c                 ~    U R                  U5      (       d  g [        R                  " U R                  U5      SU0S9  g )Nr   r   )ru   rC   add_breadcrumb_breadcrumb_from_recordr<   s     r$   r   BreadcrumbHandler._emit5  s9    ''!!((0f7M	
r&   c                     SU R                  U5      UR                  UR                  [        R                  " UR
                  [        R                  5      U R                  U5      S.$ )Nlog)r   r,   categoryre   	timestampdata)	r|   r#   re   r   fromtimestampr]   r   utcr   r<   s     r$   r   )BreadcrumbHandler._breadcrumb_from_record>  sS     11&9~~!//M++F3
 	
r&   rX   N)	rO   rP   rQ   rR   r   r   r   r   rW   rX   r&   r$   r0   r0   (  s    &
	
r&   r0   c                   $    \ rS rSrSrS rS rSrg)r1   iJ  z
A logging handler that records Sentry logs for each Python log record.

Note that you do not have to use this class if the logging integration is enabled, which it is by default.
c                    [        5          U R                  U5        U R                  U5      (       d
   S S S 5        g [        R                  " 5       nUR                  5       (       d
   S S S 5        g [        UR                  5      (       d
   S S S 5        g U R                  X!5        S S S 5        g ! , (       d  f       g = fr9   )	r   r   ru   rC   rD   r   r   r   _capture_log_from_record)r3   r=   r   s      r$   r   SentryLogsHandler.emitQ  s    (*KK##F++ +*
  **,F##%% +* $FNN33 +* ))&9 +**s   )B/+B/1B/B//
B=c           
      8   [        UR                  [        5      u  p4UR                  S   nU R	                  U5      nSUS'   SnUR
                  Gb  [        UR
                  [        5      (       al  [        UR
                  5      n[        UR
                  5       H=  u  p[        U	[        [        [        [        45      (       a  U	O
[        U	5      USU 3'   M?     O[        UR
                  [        5      (       ap  [        UR
                  5      nUR
                  R                  5        H=  u  p[        U[        [        [        [        45      (       a  UO
[        U5      USU
 3'   M?     U(       a.  [        UR                   [        5      (       a  UR                   US'   UR"                  (       a  UR"                  US'   UR$                  (       aQ  Ub?  UR$                  R'                  U5      (       a  UR$                  [)        U5      S-   S  US	'   OUR$                  US	'   UR*                  (       a  UR*                  US
'   UR,                  (       a  UR,                  US'   UR.                  (       a  UR.                  US'   UR0                  (       a  UR0                  US'   UR2                  (       a  UR2                  US'   UR4                  (       a  UR4                  US'   UR7                  UUUR8                  U[        UR:                  S-  5      S S.5        g )Nproject_rootzauto.logger.logzsentry.originFzsentry.message.parameter.zsentry.message.templatezcode.line.number   zcode.file.pathzcode.function.namez	thread.idzthread.namezprocess.pidzprocess.executable.namezlogger.nameg    eA)severity_textseverity_numberbody
attributestime_unix_nanotrace_id)r   r:   SEVERITY_TO_OTEL_SEVERITYr   r   r\   r   tuplebool	enumerater   floatintr   dictr   rh   rd   ri   r   lenra   rp   rq   rj   rk   r#   _capture_experimental_logre   r]   )r3   r   r=   otel_severity_numberotel_severity_textr   attrsparameters_setiargkeyvalues               r$   r   *SentryLogsHandler._capture_log_from_recorda  s|   3ENN54
0 ~~n5''/!2o;;"&++u--!%fkk!2'4FA &cCT+BCC &s^ 5aS9: 5 FKK..!%fkk!2"(++"3"3"5JC &ec5#t-DEE &u- 5cU;< #6 jS99 06zzE+,==(.E$%??'FOO,F,F|,T,T*0//#l:Ka:O:Q*R&'*0//&'??*0//E&'==!'E+#)#4#4E- >>#)>>E- /5/A/AE+,;;#);;E-  	((!3#7#"%fnns&:"; 		
r&   rX   N)rO   rP   rQ   rR   r   r   r   rW   rX   r&   r$   r1   r1   J  s    : D
r&   r1   )1r*   r   r   r   r   rC   sentry_sdk.clientr   sentry_sdk.loggerr   sentry_sdk.utilsr   r	   r
   r   r   r   sentry_sdk.integrationsr   typingr   collections.abcr   r   r   r   r   INFOrT   ERRORrU   NOTSETDEBUGWARNWARNINGFATALCRITICALry   r   setr!   r%   r(   HandlerrZ   r2   SentryHandlerr0   r1   rX   r&   r$   <module>r      sD    
 '   ( 0  0  .!mm NNHMM7LL&LL)OOYMM7MM7g	  bMM2OORLL!MM1  I 
DB DBN4
7?? 4
nW3< W3v 
 
D[
 [
r&   