diff --git a/monai/bundle/scripts.py b/monai/bundle/scripts.py index 598d938cbd..4718344bab 100644 --- a/monai/bundle/scripts.py +++ b/monai/bundle/scripts.py @@ -10,6 +10,7 @@ # limitations under the License. from __future__ import annotations +from io import StringIO import ast import json @@ -116,10 +117,20 @@ def _pop_args(src: dict, *args: Any, **kwargs: Any) -> tuple: def _log_input_summary(tag: str, args: dict) -> None: - logger.info(f"--- input summary of monai.bundle.scripts.{tag} ---") +<<<<<<< HEAD + log_buffer = StringIO() + log_buffer.write(f"--- input summary of monai.bundle.scripts.{tag} ---\n") for name, val in args.items(): - logger.info(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}") - logger.info("---\n\n") + log_buffer.write(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}\n") + log_buffer.write("---\n\n") +======= + log_buffer = StringIO() + log_buffer.write(f"--- input summary of monai.bundle.scripts.{tag} ---\n") + for name, val in args.items(): + log_buffer.write(f"> {name}: {pprint_edges(val, PPRINT_CONFIG_N)}\n") + log_buffer.write("---\n\n") +>>>>>>> 28f5ebe7e3a0487b9d78123a80d565f1fa26615a + logger.info(log_buffer.getvalue()) # output all content in buffer def _get_var_names(expr: str) -> list[str]: