From 21169e560d65fb0272edd14926880eea4576deee Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 13 Aug 2024 08:46:29 +0200 Subject: [PATCH] fix call of logging --- package/PartSeg/_roi_analysis/export_batch.py | 2 +- package/PartSeg/common_backend/segmentation_thread.py | 4 +++- package/PartSeg/common_gui/advanced_tabs.py | 2 +- package/PartSegCore/analysis/load_functions.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package/PartSeg/_roi_analysis/export_batch.py b/package/PartSeg/_roi_analysis/export_batch.py index d65b98889..fa3bd31be 100644 --- a/package/PartSeg/_roi_analysis/export_batch.py +++ b/package/PartSeg/_roi_analysis/export_batch.py @@ -392,7 +392,7 @@ def sleep_with_rate(response: requests.Response): reset = int(response.headers["X-RateLimit-Reset"]) sleep_time = reset - time.time() if sleep_time > 0: - logging.info("Sleeping for {sleep_time} seconds", extra={"sleep_time": sleep_time}) + logging.info("Sleeping for %(sleep_time) seconds", extra={"sleep_time": sleep_time}) time.sleep(sleep_time) diff --git a/package/PartSeg/common_backend/segmentation_thread.py b/package/PartSeg/common_backend/segmentation_thread.py index 29d79a04a..ba002de00 100644 --- a/package/PartSeg/common_backend/segmentation_thread.py +++ b/package/PartSeg/common_backend/segmentation_thread.py @@ -48,7 +48,9 @@ def run(self): """the calculation are done here""" if self.algorithm.image is None: # assertion for running algorithm without image - logging.error("No image in class {cls_name}", extra={"cls_name": self.algorithm.__class__}) + logging.error( + "No image in class %(cls_name)", extra={"cls_name": self.algorithm.__class__}, stack_info=True + ) return try: segment_data = self.algorithm.calculation_run_wrap(self.send_info) diff --git a/package/PartSeg/common_gui/advanced_tabs.py b/package/PartSeg/common_gui/advanced_tabs.py index da9f1b53e..2244f4df2 100644 --- a/package/PartSeg/common_gui/advanced_tabs.py +++ b/package/PartSeg/common_gui/advanced_tabs.py @@ -67,7 +67,7 @@ def __init__(self, parent=None): def reload_algorithm_action(self): """Function for reload plugins and algorithms""" - msg = "Reloading {mod_name}" + msg = "Reloading %(mod_name)" for val in register.reload_module_list: logging.info(msg, extra={"mod_name": val.__name__}) importlib.reload(val) diff --git a/package/PartSegCore/analysis/load_functions.py b/package/PartSegCore/analysis/load_functions.py index 5b918ca18..faaf6e7e0 100644 --- a/package/PartSegCore/analysis/load_functions.py +++ b/package/PartSegCore/analysis/load_functions.py @@ -127,7 +127,7 @@ def load_project_from_tar(tar_file, file_path): algorithm_parameters=algorithm_dict, ) logging.warning( - "This project {proj_ver} is from new version of PartSeg: {version} ", + "This project %(proj_ver) is from new version of PartSeg: %(version)", extra={"version": version, "proj_ver": project_version_info}, ) return ProjectTuple(