Skip to content

Commit a29f90f

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

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

converter/converter/cisu/resources_info/resources_info_cisu_helper.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,26 @@ 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_prefix = "and" if rs_ri is not None else "into"
114+
rs_sr_distribution_id_list = f"{rs_sr_prefix} {len(rs_sr_list)} RS-SR(s) {[rs_sr.get('distributionID') for rs_sr in rs_sr_list]}"
115+
116+
logger.info(
117+
" ".join(
118+
filter(
119+
None, [original_message_chunk, rs_ri_chunk, rs_sr_distribution_id_list]
120+
)
121+
)
122+
)

0 commit comments

Comments
 (0)