Skip to content

Commit 01973b8

Browse files
committed
feat(converter): new log_cisu_to_rs_converted_messages_ids method
1 parent f08c94a commit 01973b8

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

converter/converter/cisu/resources_info/resources_info_cisu_helper.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,25 @@ def enrich_rs_ri_with_rs_srs(
9797
def get_latest_state(states: list[dict]) -> dict:
9898
"""Return the state with the most recent datetime from a list of states."""
9999
return sorted(states, key=lambda x: x.get("datetime", ""))[-1]
100+
101+
102+
def log_cisu_to_rs_converted_messages_ids(
103+
original_message: dict, rs_ri: dict | None, rs_sr_list: list[dict]
104+
) -> None:
105+
original_message_chunk = (
106+
f"Converted RC-RI with distributionID {original_message.get('distributionID')}"
107+
)
108+
109+
rs_ri_chunk = (
110+
f"into RS-RI {rs_ri.get('distributionID')}" if rs_ri is not None else None
111+
)
112+
113+
rs_sr_chunk = None
114+
if rs_sr_list:
115+
rs_sr_ids = [rs_sr.get("distributionID") for rs_sr in rs_sr_list]
116+
rs_sr_prefix = "and" if rs_ri is not None else "into"
117+
rs_sr_chunk = f"{rs_sr_prefix} {len(rs_sr_list)} RS-SR(s) {rs_sr_ids}"
118+
119+
logger.info(
120+
" ".join(filter(None, [original_message_chunk, rs_ri_chunk, rs_sr_chunk]))
121+
)

0 commit comments

Comments
 (0)