ó
    Ú°›j«  ã                   ó¦   • % S r SSKJrJr  SSKrSSKrSSKJr  Sr/ SQr	\" SSS9r
\\\      \S	'   S
\\   S\4S jrS\4S jrS r " S S5      rg)aÑ  
PodWorker | modules | logging.py

Log Levels (Level - Value - Description)

NOTSET - 0 - No logging is configured, the logging system is effectively disabled.
DEBUG - 1 - Detailed information, typically of interest only when diagnosing problems. (Default)
INFO - 2 - Confirmation that things are working as expected.
WARN - 3 - An indication that something unexpected happened.
ERROR - 4 - Serious problem, the software has not been able to perform some function.
é    )Ú
ContextVarÚTokenN)ÚOptionali   )ÚNOTSETÚTRACEÚDEBUGÚINFOÚWARNÚERRORÚrunpod_batch_id)ÚdefaultÚ	_batch_idÚbatch_idÚreturnc                 ó,   • [         R                  U 5      $ )z6Set the batch ID associated with the current job task.)r   Úset)r   s    Ú`/home/mande/repo/quber/.venv/lib/python3.13/site-packages/runpod/serverless/modules/rp_logger.pyÚ_set_batch_idr      s   € ä�=‰=˜Ó"Ð"ó    Útokenc                 ó.   • [         R                  U 5        g)z7Restore the previous batch ID for the current job task.N)r   Úreset)r   s    r   Ú_reset_batch_idr      s   € ä‡O�O�EÕr   c                 ó&  • [        U [        5      (       a*  U R                  5       n U [        ;  a  [	        SU  35      eU $ [        U [
        5      (       a0  U S:  d  U [        [        5      :¼  a  [	        SU  35      e[        U    $ [	        SU  35      e)z:
Checks the debug level and returns the debug level name.
zInvalid debug level: r   )Ú
isinstanceÚstrÚupperÚ
LOG_LEVELSÚ
ValueErrorÚintÚlen)Ú	log_levels    r   Ú_validate_log_levelr#   !   sŽ   € ô �)œS×!Ñ!Ø—O‘OÓ%ˆ	àœJÓ&ÜÐ4°Y°KÐ@ÓAÐAàÐä�)œS×!Ñ!Ø�q‹=˜I¬¬Z«Ó8ÜÐ4°Y°KÐ@ÓAÐAä˜)Ñ$Ð$ä
Ð,¨Y¨KÐ8Ó
9Ð9r   c            	       ó.  • \ rS rSrSrSr\" \R                  R                  S\R                  R                  SS5      5      5      r
S rS rSS	 jrS
 rSS\\   4S jjrSS\\   4S jjrSS\\   4S jjrSS\\   4S jjrS rSS\\   4S jjrSrg)ÚRunPodLoggeré6   zSingleton class for logging.NÚRUNPOD_LOG_LEVELÚRUNPOD_DEBUG_LEVELr   c                 ó€   • [         R                  c  [        R                  U 5      [         l        [         R                  $ ©N)r%   Ú_RunPodLogger__instanceÚobjectÚ__new__)Úclss    r   r-   ÚRunPodLogger.__new__@   s+   € Ü×"Ñ"Ñ*Ü&,§n¡n°SÓ&9ŒLÔ#Ü×&Ñ&Ð&r   c                 ó`   • [        U5      U l        U R                  SU R                   35        g)zV
Set the debug level for logging.
Can be set to the name or value of the debug level.
zLog level set to N)r#   ÚlevelÚinfo)ÚselfÚ	new_levels     r   Ú	set_levelÚRunPodLogger.set_levelE   s(   € ô
 )¨Ó3ˆŒ
Ø�	‰	Ð% d§j¡j \Ð2Õ3r   c                 ól  • U R                   S:X  a  g[        R                  U R                   5      nU[        R                  U5      :”  a  US:w  a  g[        U5      n[        R                  5       =n(       a  SU SU 3n[        U5      [        :”  a/  [        S-  n[        U5      [        -
  nSU S3nUSU U-   X* S -   n[        R                  R                  S	5      (       a$  X1US
.n	[        [        R                  " U	5      SS9  gU(       a  U SU 3n[        UR                  S5       SU 3SS9  g)z0
Log message to stdout if RUNPOD_DEBUG is true.
r   NÚTIPz	[batchId=z] é   z
...TRUNCATED z CHARACTERS...
ÚRUNPOD_ENDPOINT_ID)Ú	requestIdÚmessager1   T)Úflushz | é   z| )r1   r   Úindexr   r   Úgetr!   ÚMAX_MESSAGE_LENGTHÚosÚenvironÚprintÚjsonÚdumpsÚljust)
r3   r<   Úmessage_levelÚjob_idÚlevel_indexr   Úhalf_max_lengthÚtruncated_amountÚtruncation_noteÚlog_jsons
             r   ÚlogÚRunPodLogger.logM   s:  € ð �:‰:˜Ó!Øä ×&Ñ& t§z¡zÓ2ˆØœ×)Ñ)¨-Ó8Ó8¸]ÈeÓ=SØä�g“,ˆÜ —}‘}“Ð&ˆ8Õ&Ø! ( ¨2¨g¨YÐ7ˆGô ˆw‹<Ô,Ó,Ü0°AÑ5ˆOÜ" 7›|Ô.@Ñ@ÐØ /Ð0@Ð/AÐAQÐRˆOàÐ(˜Ð)¨OÑ;¸gÐFVÐFWÐ>XÑXð ô �:‰:�>‰>Ð.×/Ñ/Ø%+È-ÑXˆHÜ”$—*’*˜XÓ&¨dÒ3ØæØ˜  G 9Ð-ˆGä�×$Ñ$ QÓ'Ð(¨¨7¨)Ð4¸DÒAØr   c                 ó€   • [        U5      nUS   S[        U5      S-
  -  -   US   -   nU R                  U SU 35        g)z^
Censors secrets for logging.
Replaces everything except the first and last characters with *
r   Ú*r9   éÿÿÿÿz: N)r   r!   r2   )r3   Úsecret_nameÚsecretÚredacted_secrets       r   rU   ÚRunPodLogger.secretp   sI   € ô
 �V“ˆØ  ™) c¬S°«[¸1©_Ñ&=Ñ=ÀÀrÁ
ÑJˆØ�	‰	�[�M  OÐ#4Ð5Õ6r   Ú
request_idc                 ó*   • U R                  USU5        g)z
debug log
r   N©rO   ©r3   r<   rX   s      r   ÚdebugÚRunPodLogger.debugy   ó   € ð 	�‰�˜' :Õ.r   c                 ó*   • U R                  USU5        g)z

info log
r	   NrZ   r[   s      r   r2   ÚRunPodLogger.info   ó   € ð 	�‰�˜& *Õ-r   c                 ó*   • U R                  USU5        g)z

warn log
r
   NrZ   r[   s      r   ÚwarnÚRunPodLogger.warn…   ra   r   c                 ó*   • U R                  USU5        g)z
error log
r   NrZ   r[   s      r   ÚerrorÚRunPodLogger.error‹   r^   r   c                 ó(   • U R                  US5        g)z	
tip log
r8   NrZ   )r3   r<   s     r   ÚtipÚRunPodLogger.tip‘   s   € ð 	�‰�˜%Õ r   c                 ó*   • U R                  USU5        g)z$
trace log (buffered until flushed)
r   NrZ   r[   s      r   ÚtraceÚRunPodLogger.trace—   r^   r   )r1   )r	   Nr*   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r+   r#   rB   rC   r@   r1   r-   r5   rO   rU   r   r   r\   r2   rc   rf   ri   rl   Ú__static_attributes__© r   r   r%   r%   6   s¨   † Ù&à€JÙØ
�
‰
�‰Ø §
¡
§¡Ð/CÀWÓ Mó	
ó€Eò'ò
4ô!òF7ñ/¨°#©õ /ñ.¨°©õ .ñ.¨°©õ .ñ/¨°#©õ /ò!ñ/¨°#©÷ /ð /r   r%   )rr   Úcontextvarsr   r   rE   rB   Útypingr   rA   r   r   r   Ú__annotations__r   r   r#   r%   rt   r   r   Ú<module>rx      sr   ðò
÷ *Û Û 	Ý àÐ ÚB€
Ù'1Ð2CÈTÑ'R€	ˆ:�h˜s‘mÑ$Ó Rð#˜H S™Mð #¨eô #ð
˜5ô ò
:÷*e/ò e/r   