diff --git a/scripts/wk/log.py b/scripts/wk/log.py index 6ce46a8b..3bf61f17 100644 --- a/scripts/wk/log.py +++ b/scripts/wk/log.py @@ -39,16 +39,21 @@ def enable_debug_mode() -> None: def format_log_path( - log_dir: None | pathlib.Path | str = None, - log_name: None | str = None, + log_dir: pathlib.Path | str | None = None, + log_name: str | None = None, + append: bool = False, + kit: bool = False, + sub_dir: str | None = None, timestamp: bool = False, - kit: bool = False, tool: bool = False, append: bool = False, + tool: bool = False, ) -> pathlib.Path: """Format path based on args passed, returns pathlib.Path obj.""" log_path = pathlib.Path( f'{log_dir if log_dir else DEFAULT_LOG_DIR}/' f'{cfg.main.KIT_NAME_FULL+"/" if kit else ""}' f'{"Tools/" if tool else ""}' + f'{sub_dir+"_" if sub_dir else ""}' + f'{time.strftime("%Y-%m-%d_%H%M%S%z") if sub_dir else ""}/' f'{log_name if log_name else DEFAULT_LOG_NAME}' f'{"_" if timestamp else ""}' f'{time.strftime("%Y-%m-%d_%H%M%S%z") if timestamp else ""}' @@ -127,9 +132,11 @@ def start(config: dict[str, str] | None = None) -> None: def update_log_path( - dest_dir: None | pathlib.Path | str = None, - dest_name: None | str = None, - keep_history: bool = True, timestamp: bool = True, append: bool = False, + dest_dir: None | pathlib.Path | str = None, + dest_name: None | str = None, + append: bool = False, + keep_history: bool = True, + timestamp: bool = True, ) -> None: """Moves current log file to new path and updates the root logger.""" root_logger = logging.getLogger()