Parcourir la source

refactor: fix formatting, remove timestamp in CLI mode and Module in CI mode

Sam Jaffe il y a 1 mois
Parent
commit
9bf4c27985
3 fichiers modifiés avec 8 ajouts et 3 suppressions
  1. 4 1
      src/cipy/__init__.py
  2. 1 0
      src/cipy/_io.py
  3. 3 2
      src/cipy/runner.py

+ 4 - 1
src/cipy/__init__.py

@@ -17,7 +17,10 @@ from . import settings
 from ._logging import CIFormatter
 
 _handler = logging.StreamHandler()
-_handler.setFormatter(CIFormatter("%(asctime)s [%(name)s] %(message)s"))
+if settings.INTERACTIVE:
+    _handler.setFormatter(CIFormatter("[%(name)s] %(message)s"))
+else:
+    _handler.setFormatter(CIFormatter("%(asctime)s  %(message)s"))
 
 logging.basicConfig(datefmt="%Y-%m-%dT%H:%M:%S.%fZ",
                     handlers=[ _handler ],

+ 1 - 0
src/cipy/_io.py

@@ -3,6 +3,7 @@
 import contextlib
 import io
 
+
 @contextlib.contextmanager
 def capture_stdout():
     wrap = io.StringIO()

+ 3 - 2
src/cipy/runner.py

@@ -76,8 +76,9 @@ def ipc(func: Run[Action]) -> Run[Action]:
 
 
 @contextmanager
-def logging_group(self: Action, msg: str, *args: Any,
-                  ci_only: bool = False) -> Iterator[None]:
+def logging_group(
+    self: Action, msg: str, *args: Any, ci_only: bool = False
+) -> Iterator[None]:
     """
     Create a 'group' for logging messages under, allows for a GUI to apply cleaner formatting