|
|
@@ -125,29 +125,29 @@ def preamble(
|
|
|
if extra is None:
|
|
|
extra = []
|
|
|
|
|
|
- def log_inputs(self: Action) -> None:
|
|
|
- inputs = [
|
|
|
- (k, v) for k, v in vars(self.inputs).items() if v is not None and v != ""
|
|
|
- ]
|
|
|
- if inputs:
|
|
|
- self.logger.info("with:")
|
|
|
- for key, value in inputs:
|
|
|
- self.logger.info(" %s: %s", key, value)
|
|
|
-
|
|
|
- def log_extra(self: Action, color: str, lines: str | Iterable[str]) -> None:
|
|
|
- fmt = f"{color}%s{Style.reset}"
|
|
|
- if isinstance(lines, str):
|
|
|
- self.logger.info(fmt, lines)
|
|
|
- else:
|
|
|
- for line in lines:
|
|
|
- self.logger.info(fmt, line)
|
|
|
-
|
|
|
@functools.wraps(func)
|
|
|
def wrapper(self: Action, context: Context) -> Status:
|
|
|
with logging_group(self, "Run %s", self.name):
|
|
|
- log_inputs(self)
|
|
|
+ _log_inputs(self)
|
|
|
for color, get_lines in extra:
|
|
|
- log_extra(self, color, get_lines(self))
|
|
|
+ _log_extra(self, color, get_lines(self))
|
|
|
return func(self, context)
|
|
|
|
|
|
return wrapper
|
|
|
+
|
|
|
+
|
|
|
+def _log_inputs(self: Action) -> None:
|
|
|
+ inputs = [(k, v) for k, v in vars(self.inputs).items() if v is not None and v != ""]
|
|
|
+ if inputs:
|
|
|
+ self.logger.info("with:")
|
|
|
+ for key, value in inputs:
|
|
|
+ self.logger.info(" %s: %s", key, value)
|
|
|
+
|
|
|
+
|
|
|
+def _log_extra(self: Action, color: str, lines: str | Iterable[str]) -> None:
|
|
|
+ fmt = f"{color}%s{Style.reset}"
|
|
|
+ if isinstance(lines, str):
|
|
|
+ self.logger.info(fmt, lines)
|
|
|
+ else:
|
|
|
+ for line in lines:
|
|
|
+ self.logger.info(fmt, line)
|