From 25ce3b4f290df34acebcb8102ab24dff3e5def7c Mon Sep 17 00:00:00 2001 From: ewuerger Date: Thu, 29 Feb 2024 13:41:25 +0100 Subject: [PATCH] fix(converter): Fix serialization logging --- capella2polarion/converters/element_converter.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/capella2polarion/converters/element_converter.py b/capella2polarion/converters/element_converter.py index 2fa8b248..a093e2c3 100644 --- a/capella2polarion/converters/element_converter.py +++ b/capella2polarion/converters/element_converter.py @@ -145,11 +145,18 @@ def serialize(self, uuid: str) -> data_models.CapellaWorkItem | None: converter_data.work_item = None if converter_data.errors: - logger.error( - "Serialization of %r successful, but with warnings: \n\t %s", + log_args = ( converter_data.capella_element._short_repr_(), "\n\t".join(converter_data.errors), ) + if converter_data.work_item is None: + logger.error("Serialization of %r failed:\n\t %s", *log_args) + else: + logger.warning( + "Serialization of %r successful, but with warnings:" + "\n\t %s", + *log_args, + ) return converter_data.work_item # General helper functions