o
    i                     @   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FileHandler_log_formatter_cls
log_format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   h_debug_handler_log_formatterex_exc_tracebackmsgline rA   N/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jupyterlab/debuglog.pydebug_logging   sR   









zDebugLogFileMixin.debug_loggingN)__name__
__module____qualname__r   r   
contextlibcontextmanagerrC   rA   rA   rA   rB   r      s    r   )__doc__rG   r   r   r&   r   r(   r.   	traitletsr   traitlets.configr   r   rA   rA   rA   rB   <module>   s    