in ez_wsi_dicomweb/ez_wsi_logging_factory.py [0:0]
def _build_msg(self, msg: str, *args: OptionalStructureElements) -> str:
"""Builds log msg from msg and structure elements."""
optional_args = collections.OrderedDict()
found_exception = None
for element in args:
if element is None or not element:
continue
if isinstance(element, Mapping):
_merge_dict_sorted_by_key(optional_args, element)
elif isinstance(element, Exception):
found_exception = element
if self._signature:
_merge_dict_sorted_by_key(optional_args, self._signature)
if found_exception is not None:
optional_args['EXCEPTION'] = found_exception
structure = '; '.join(
[f'{key}: {value}' for key, value in optional_args.items()]
)
if structure:
return f'{msg}; {structure}'
return msg