浏览代码

Tweak debug log output config

Vidar Tonaas Fauske 5 年之前
父节点
当前提交
a75b849af7
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 4 2
      jupyterlab/debuglog.py
  2. 1 0
      jupyterlab/labapp.py

+ 4 - 2
jupyterlab/debuglog.py

@@ -16,13 +16,15 @@ import traceback
 from traitlets import HasTraits, Unicode, default
 
 class DebugLogFileMixin(HasTraits):
-    debug_log_path = Unicode('', config=True, help='TODO')
+    debug_log_path = Unicode('', config=True, help='Path to use for the debug log file')
 
     @contextlib.contextmanager
     def debug_logging(self):
         log_path = self.debug_log_path
+        if os.path.isdir(log_path):
+            log_path = os.path.join(log_path, 'jupyterlab-debug.log')
         if not log_path:
-            handle, log_path = tempfile.mkstemp(prefix='jupyterlab-log-', suffix='.log')
+            handle, log_path = tempfile.mkstemp(prefix='jupyterlab-debug-', suffix='.log')
             os.close(handle)
         log = self.log
 

+ 1 - 0
jupyterlab/labapp.py

@@ -30,6 +30,7 @@ build_aliases['app-dir'] = 'LabBuildApp.app_dir'
 build_aliases['name'] = 'LabBuildApp.name'
 build_aliases['version'] = 'LabBuildApp.version'
 build_aliases['dev-build'] = 'LabBuildApp.dev_build'
+build_aliases['debug-log-path'] = 'DebugLogFileMixin.debug_log_path'
 
 build_flags = dict(flags)