Skip to content

Commit b96e6fc

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

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+
if rs_ri is None and len(rs_sr_list) == 0:
106+
logger.info(
107+
f"No RS message produced when converting RC-RI with distributionId {original_message.get('distributionID')}."
108+
)
109+
110+
else:
111+
log_message = f"Converted RC-RI with distributionID {original_message.get('distributionID')} into"
112+
113+
if rs_ri is not None:
114+
log_message += f" RS-RI {rs_ri.get('distributionID')}"
115+
116+
if rs_sr_list:
117+
if rs_ri is not None:
118+
log_message += " and"
119+
rs_sr_ids = [rs_sr.get("distributionID") for rs_sr in rs_sr_list]
120+
log_message += f" {len(rs_sr_list)} RS-SR(s) {rs_sr_ids}"
121+
122+
logger.info(log_message)

0 commit comments

Comments
 (0)