diff options
Diffstat (limited to 'Omni/Repl.py')
-rwxr-xr-x | Omni/Repl.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Omni/Repl.py b/Omni/Repl.py index 8d191e2..d7d2fb4 100755 --- a/Omni/Repl.py +++ b/Omni/Repl.py @@ -20,7 +20,6 @@ additional files to load. import importlib import importlib.util import inspect -import logging import mypy.api import Omni.Log as Log import os @@ -34,6 +33,8 @@ import types import typing import unittest +LOG = Log.setup() + class ReplError(Exception): """Type for errors at the repl.""" @@ -48,7 +49,7 @@ def use(ns: str, path: str) -> None: Raises: ReplError: if module cannot be loaded """ - logging.info("loading %s from %s", ns, path) + LOG.info("loading %s from %s", ns, path) spec = importlib.util.spec_from_file_location(ns, path) if spec is None or spec.loader is None: msg = f"spec could not be loaded for {ns} at {path}" @@ -71,7 +72,7 @@ def typecheck(path: str) -> None: # this envvar is undocumented, but it works # https://github.com/python/mypy/issues/13815 os.environ["MYPY_FORCE_COLOR"] = "1" - logging.info("typechecking %s", path) + LOG.info("typechecking %s", path) stdout, stderr, _ = mypy.api.run([path]) sys.stdout.write(stdout) sys.stdout.flush() @@ -89,7 +90,7 @@ def edit_file(ns: str, path: str, editor: str) -> None: try: proc = subprocess.run([editor, path], check=False) except FileNotFoundError: - logging.exception("editor '%s' not found", editor) + LOG.exception("editor '%s' not found", editor) if proc.returncode == 0: use(ns, path) typecheck(path) |