o
    o°×iS  ã                   @   s"   d dl Z d dlZG dd„ dƒZdS )é    Nc                   @   s,   e Zd Zdd„ Zdd„ Zd	ddœdd„ZdS )
ÚErrorInterceptorc                 C   s   || _ || _d S ©N)Ú_should_catchÚ_handler_id)ÚselfÚshould_catchÚ
handler_id© r	   úW/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/loguru/_error_interceptor.pyÚ__init__   s   
zErrorInterceptor.__init__c                 C   s   | j S r   )r   )r   r	   r	   r
   r   
   s   zErrorInterceptor.should_catchN)Ú	exceptionc                C   sØ   t jsd S |d u rt  ¡ \}}}nt|ƒ||j}}}zKz5t j d| j ¡ zt|ƒ}W n ty8   d}Y nw t j d| ¡ t	 
|||d t j¡ t j d¡ W n	 ty[   Y nw W ~~~d S W ~~~d S ~~~w )Nz,--- Logging error in Loguru Handler #%d ---
z/!\ Unprintable record /!\zRecord was: %s
z--- End of logging error ---
)ÚsysÚstderrÚexc_infoÚtypeÚ__traceback__Úwriter   ÚstrÚ	ExceptionÚ	tracebackÚprint_exceptionÚOSError)r   Úrecordr   Útype_ÚvalueÚ
traceback_Úrecord_reprr	   r	   r
   Úprint   s,   ÿÿÿ
þzErrorInterceptor.printr   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r	   r	   r	   r
   r      s    r   )r   r   r   r	   r	   r	   r
   Ú<module>   s    