diff --git a/csst_common/data_manager.py b/csst_common/data_manager.py index efff6b4cd53bb0398dc9248cb4133426865b4c53..5c926fe58cb6b153a27f417a5a0fa7ba5d9dc353 100644 --- a/csst_common/data_manager.py +++ b/csst_common/data_manager.py @@ -880,7 +880,7 @@ class CsstMsDataManager: self.logger_ppl.info( f"Results from DFS CATAPI:\n" f" - code = {cat['code']}\n" - f" - msg = {cat['msg']}\n" + f" - message = {cat['message']}\n" f" - totalCount = {cat['totalCount']}\n" f" - columns = {cat['columns']}" ) @@ -889,7 +889,7 @@ class CsstMsDataManager: self.logger_ppl.info( f"Results from DFS CATAPI:\n" f" - code = {cat['code']}\n" - f" - msg = {cat['msg']}" + f" - message = {cat['message']}" ) raise ValueError("Bad catalog query result!") @@ -921,7 +921,7 @@ class CsstMsDataManager: # query for L0 data print(f"Query obs_id={obs_id} ...", end="") recs = Level0DataApi().find(obs_id=obs_id) - print("MessageWriter: \n", recs) + print("Message: \n", recs) print(f"{recs['totalCount']} records obtained!") assert recs["code"] == 0 assert recs["totalCount"] > 0 diff --git a/csst_common/logger.py b/csst_common/logger.py index bae50cc5979914da5b09eee39f462b88d0bbf3a7..2850eea547622204cc6aa2e3b1d9977dd1fb1cd7 100644 --- a/csst_common/logger.py +++ b/csst_common/logger.py @@ -51,7 +51,7 @@ def get_logger(name: str = "CSST pipeline", filename: Optional[str] = None): # logging formatter formatter = logging.Formatter( - "%(asctime)s - %(levelname)s - %(module)s.py:%(lineno)d - %(msg)s" + "%(asctime)s - %(levelname)s - %(module)s.py:%(lineno)d - %(message)s" ) # stream handler diff --git a/csst_common/pipeline.py b/csst_common/pipeline.py index f6440f036f13c83dad8eb320bf316b1458203740..f4ef65475f2f2366aaba8008573bed0dfb07a7c3 100644 --- a/csst_common/pipeline.py +++ b/csst_common/pipeline.py @@ -98,8 +98,8 @@ class Pipeline: os.chdir(self.dir_output) # Frequently used files - self.msg = MessageWriter(os.path.join(self.dir_output, "message.txt")) - self.tsr = TimestampRecorder(os.path.join(self.dir_output, "timestamp.txt")) + self.message = Message(os.path.join(self.dir_output, "message.txt")) + self.timestamp = Timestamp(os.path.join(self.dir_output, "timestamp.txt")) # self.exit_code = ExitCode(os.path.join(self.dir_output, "exit_code")) # self.error_trace = ErrorTrace(os.path.join(self.dir_output, "error_trace")) @@ -168,10 +168,10 @@ class Pipeline: # f.write(s) -class MessageWriter: +class Message: """Write JSON format messages to file.""" - def __init__(self, file_path=""): + def __init__(self, file_path: str = ""): self.file_path = file_path def __repr__(self): @@ -211,12 +211,12 @@ class MessageWriter: # print(f"Exit with code {code} (written to '{self.file_path}')") -class TimestampRecorder: - def __init__(self, file_path: str = "tsr.txt"): +class Timestamp: + def __init__(self, file_path: str = "timestamp.txt"): """ - TimestampRecorder Class. + Timestamp Class. - Initialize a TimestampRecorder object anc connect it to `file_path`. + Initialize a Timestamp object anc connect it to `file_path`. Parameters ---------- @@ -226,7 +226,7 @@ class TimestampRecorder: self.file_path = file_path def __repr__(self): - return f"< TimestampRecorder [{self.file_path}] >" + return f"< Timestamp [{self.file_path}] >" def empty(self): """Clean time stamp file."""