|
|
@@ -12,6 +12,7 @@ from typing import Any, Callable, Iterator, TypeVar
|
|
|
from dotenv import dotenv_values
|
|
|
|
|
|
import cipy.common
|
|
|
+from cipy import settings
|
|
|
from cipy.common import Context, Status, _validate
|
|
|
|
|
|
Action = TypeVar("Action", bound=cipy.common.Action)
|
|
|
@@ -75,14 +76,25 @@ def ipc(func: Run[Action]) -> Run[Action]:
|
|
|
|
|
|
|
|
|
@contextmanager
|
|
|
-def logging_group(self: Action, message: str, *args: Any) -> 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
|
|
|
+
|
|
|
+ :param Action self: The calling action
|
|
|
+ :param str msg: A message with optional formatting marks, see logging.Logger.log
|
|
|
+ :param Any *args: Any number of positional arguments for message formatting
|
|
|
+ :param bool ci_only: Should we only log anything in CI mode, or should we also
|
|
|
+ log with a slightly different format in INTERACTIVE (CLI) mode.
|
|
|
"""
|
|
|
|
|
|
- self.logger.info("##[group] " + message, *args)
|
|
|
+ if not settings.INTERACTIVE:
|
|
|
+ self.logger.info("##[group] " + msg, *args)
|
|
|
+ elif not ci_only:
|
|
|
+ self.logger.warning(msg, *args)
|
|
|
yield
|
|
|
- self.logger.info("##[endgroup]")
|
|
|
+ if not settings.INTERACTIVE:
|
|
|
+ self.logger.info("##[endgroup]")
|
|
|
|
|
|
|
|
|
def preamble(func: Run[Action]):
|