"""Custom log adapters.""" from owslogger import logger class DdexIngesterAdapter(logger.OwsLoggingAdapter): """Custom log adapter to log message id and message thread id.""" def process(self, msg, kwargs): """Process log message to add contextual information. This takes out the message thread id and message id and prepends it to the log message. Args: msg (obj): the log message. """ super().process(msg, kwargs) msg = (f'[execution_name: {self.extra.get("execution_name")}' f' / message_thread_id: {self.extra.get("message_thread_id")}]' f' / message_id: {self.extra.get("message_id")}]' f' - {msg}') return msg, kwargs