
     g                     n    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e      Zy)z$A mixin for adding a debug log file.    N)Unicode)Configurablec                   F    e Zd Z eddd      Zej                  d        Zy)DebugLogFileMixin Tz"Path to use for the debug log file)confighelpc              #   R  K   | j                   }t        j                  j                  |      r t        j                  j	                  |d      }|s/t        j                  dd      \  }}t        j                  |       | j                  }|j                  D ]  }|j                  | j                          |j                  d       t        j                  |ddd	      }| j                  | j                  | j                   
      }|j#                  |       |j                  d       |j%                  |       	 d  |j'                  |       |j)                          |j                          	 t        j*                  |       |j'                  |       y # t,        $ r Y w xY w# t.        $ r}t1        j2                         \  }}}	t5        j6                  |j8                  ||	      }
|
D ]  }| j                  j;                  |        t=        |t>              rtA        jB                  d|        tA        jB                  d       tA        jB                  |
d   jE                                tA        jB                  d|       | jG                  d       Y d }~d }~ww xY ww)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removeHandlerflushremoveFileNotFoundError	Exceptionsysexc_info	tracebackformat_exception	__class__debug
isinstance
SystemExitwarningswarnstripexit)selflog_pathhandler   h_debug_handler_log_formatterex_exc_tracebackmsglines               3lib/python3.12/site-packages/jupyterlab/debuglog.pydebug_loggingzDebugLogFileMixin.debug_logging   s    &&77=="ww||H.DEH'//7JSYZFHHHVhh AJJt~~& W !,,XsF$O00T__dN^N^0_##N3(~&	 n-  "  "		(# 	.) % %  	"%,,.Aq-,,R\\2}MCt$ "j) QRZQ]^_MM./MM#b'--/*MM:8,GHIIaLL	sU   D9J'<F(  1J'2F J'	F%"J'$F%%J'(	J$1C(JJ'J$$J'N)__name__
__module____qualname__r   r   
contextlibcontextmanagerrE        rD   r   r      s)    R3WXN,* ,*rL   r   )__doc__rI   r!   r   r-   r   r/   r5   	traitletsr   traitlets.configr   r   rK   rL   rD   <module>rP      s1    *
   	 
     )0* 0*rL   