§
    y›ju  ã                  ó†  — d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlZdd	lmZmZmZ dd
lmZ ddlmZ  e	ej        ¦  «        j        Z G d„ de¦  «        Z G d„ de¦  «        Z	  ed eej        ¦  «        j        ¦  «        Z ej        e¦  «        j         Z!dS # e"$ r dZ! ede¦  «         Y dS w xY w)z<Integration with [Loguru](https://github.com/Delgan/loguru).é    )ÚannotationsN)ÚCallable)Ú	LogRecord)ÚPath)ÚAnyÚcasté   )ÚATTRIBUTES_LOGGING_ARGS_KEYÚATTRIBUTES_MESSAGE_KEYÚATTRIBUTES_MESSAGE_TEMPLATE_KEY)Úwarn_at_user_stacklevelé   )ÚLogfireLoggingHandlerc                  ó   — e Zd ZdZdS )ÚLoguruInspectionFailedz¥Warning raised when magic introspection of loguru stack frames fails.

    This may happen if the loguru library changes in a way that breaks the introspection.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úX/home/lighthouse/health/venv/lib/python3.11/site-packages/logfire/integrations/loguru.pyr   r      s   € € € € € ðð ð ð r   r   c                  ó(   ‡ — e Zd ZdZdZdˆ fd„Zˆ xZS )	ÚLogfireHandlerz0A loguru handler that sends logs to **Logfire**.ÚloguruÚrecordr   Úreturnúdict[str, Any]c                óJ  •— t          ¦   «                              |¦  «        }|                     |                     di ¦  «        ¦  «         |j        rJ ‚t
          �rFt          j        ¦   «         }|�r|j        t
          u �r|j	        }d|v r|d         |t          <   nt          dt          ¦  «         |                     d¦  «        }t          |t          t           f¦  «        r|r
||t"          <   nt          dt          ¦  «         |                     d¦  «        }t          |t$          ¦  «        r>t          |                     d¦  «        x}t&          ¦  «        r||j        v r||t*          <   nt          dt          ¦  «         n|j        }|�°t          dt          ¦  «         |S )	zöFill attributes from a log record.

        It filters out the 'extra' attribute and adds it's content to the attributes.

        Args:
            record: The log record.

        Returns:
            The attributes for the log record.
        ÚextraÚmessagez>Failed to extract message template (span name) for loguru log.Úargsz&Failed to extract args for loguru log.Ú
log_recordz2Failed to extract original message for loguru log.z?Failed to find loguru log frame to extract detailed information)ÚsuperÚfill_attributesÚupdateÚpopr"   Ú_LOG_METHOD_CODEÚinspectÚcurrentframeÚf_codeÚf_localsr   r   r   ÚgetÚ
isinstanceÚtupleÚlistr
   ÚdictÚstrÚmsgr   Úf_back)	Úselfr   Ú
attributesÚframeÚframe_localsr"   Úoriginal_recordr!   Ú	__class__s	           €r   r%   zLogfireHandler.fill_attributes    sÆ  ø€ õ ‘W”W×,Ò,¨VÑ4Ô4ˆ
Ø×Ò˜*Ÿ.š.¨°"Ñ5Ô5Ñ6Ô6Ð6Ø”;ÐÐÐåñ '	ÝÔ(Ñ*Ô*ˆEØñ %Ø”<Õ#3Ð3Ñ3Ø#(¤>�LØ  LÐ0Ð0ØFRÐS\ÔF]˜
Õ#BÑCÐCå/Ø\Õ^tñô ð ð (×+Ò+¨FÑ3Ô3�DÝ! $­µ¨Ñ6Ô6ð rØð KØFJ˜JÕ'BÑCøå/Ð0XÕZpÑqÔqÐqà=I×=MÒ=MÈlÑ=[Ô=[�Oå" ?µDÑ9Ô9ðå&°/×2EÒ2EÀiÑ2PÔ2PÐ'P wÕRUÑVÔVðð $ v¤zÐ1Ð1ð >E˜
Õ#9Ñ:Ð:å/ØPÕRhñô ð ð àœ�ðC ñ %õF (ØUÕWmñô ð ð Ðr   )r   r   r   r   )r   r   r   r   Úcustom_scope_suffixr%   Ú__classcell__)r:   s   @r   r   r      sI   ø€ € € € € Ø:Ð:à"Ðð8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8r   r   zCallable[..., Any]zEFailed to find loguru log method code to extract detailed information)#r   Ú
__future__r   r)   Úcollections.abcr   Úloggingr   Úpathlibr   Útypingr   r   r   Ú_internal.constantsr
   r   r   Ú_internal.stack_infor   r   Ú__file__ÚparentÚLOGURU_PATHÚRuntimeWarningr   r   ÚtypeÚloggerÚ_logÚ_log_methodÚunwrapÚ__code__r(   Ú	Exceptionr   r   r   ú<module>rO      sµ  ðØ BÐ Bà "Ð "Ð "Ð "Ð "Ð "à €€€Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ð Ð à €€€à vÐ vÐ vÐ vÐ vÐ vÐ vÐ vÐ vÐ vØ :Ð :Ð :Ð :Ð :Ð :Ø *Ð *Ð *Ð *Ð *Ð *àˆd�6”?Ñ#Ô#Ô*€ðð ð ð ð ˜^ñ ô ð ð=ð =ð =ð =ð =Ð*ñ =ô =ð =ð@Ø�$Ð+¨T¨T°&´-Ñ-@Ô-@Ô-EÑFÔF€KØ%�w”~ kÑ2Ô2Ô;ÐÐÐøØð ð ð ØÐØÐØOÐQgñô ð ð ð ð ðøøøs   Á34B) Â)C Â?C 