o
    tf                     @   sh   d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ G dd deZdS )z$A mixin for adding a debug log file.    N)Unicode)Configurablec                   @   s(   e Zd ZeddddZejdd ZdS )DebugLogFileMixin Tz"Path to use for the debug log file)confighelpc              
   c   s   | j }tj|rtj|d}|s!tjddd\}}t| | j}|j	D ]}|
| j q'|
d tj|dddd	}| j| j| jd
}|| |
d || zd V  W nU ty } zIt \}}}	t|j||	}
|
D ]}| j| qtt|trtd|  td t|
d   td| | d W Y d }~n#d }~ww | | |!  |  zt"| W n	 t#y   Y nw | | d S )Nzjupyterlab-debug.logzjupyterlab-debug-z.log)prefixsuffixDEBUGwutf8T)delay)fmtdatefmtz1An error occurred. See the log file for details: zAn error occurred.zSee the log file for details:    )$debug_log_pathospathisdirjointempfilemkstempcloseloghandlerssetLevel	log_levelloggingFileHandlerZ_log_formatter_clsZ
log_formatZlog_datefmtsetFormatter
addHandler	Exceptionsysexc_info	tracebackformat_exception	__class__debug
isinstance
SystemExitwarningswarnstripexitremoveHandlerflushremoveFileNotFoundError)selflog_pathhandler   hZ_debug_handlerZ_log_formatterex_exc_tracebackmsgline r<   \/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/jupyterlab/debuglog.pydebug_logging   sR   









zDebugLogFileMixin.debug_loggingN)__name__
__module____qualname__r   r   
contextlibcontextmanagerr>   r<   r<   r<   r=   r      s    r   )__doc__rB   r   r   r#   r   r%   r+   Z	traitletsr   Ztraitlets.configr   r   r<   r<   r<   r=   <module>   s    