浏览代码

reuse the logerrorhandler

Steven Silvester 6 年之前
父节点
当前提交
3cc8a383ea
共有 1 个文件被更改,包括 1 次插入10 次删除
  1. 1 10
      examples/example_check.py

+ 1 - 10
examples/example_check.py

@@ -21,6 +21,7 @@ import subprocess
 from tornado.ioloop import IOLoop
 from traitlets import Bool, Unicode
 from jupyterlab.labapp import get_app_dir
+from jupyterlab.browser_check import LogErrorHandler
 
 here = osp.abspath(osp.dirname(__file__))
 
@@ -33,16 +34,6 @@ mod = importlib.util.module_from_spec(spec)
 spec.loader.exec_module(mod)
 
 
-class LogErrorHandler(logging.Handler):
-    """A handler that exits with 1 on a logged error."""
-    def emit(self, record):
-        if record.level < logging.ERROR:
-            return
-        print(record.msg, file=sys.stderr)
-        logging.shutdown()
-        sys.exit(1)
-
-
 class ExampleCheckApp(mod.ExampleApp):
     """An example app that adds instrumentation."""
     open_browser = Bool(False)