Merge "Add logs in the SampleEndpoint class"

This commit is contained in:
Zuul 2023-11-24 13:11:15 +00:00 committed by Gerrit Code Review
commit ad2c9900bd
2 changed files with 12 additions and 3 deletions

View File

@ -132,7 +132,11 @@ class NotificationService(cotyledon.Service):
endpoints = []
for pipe_mgr in self.managers:
endpoints.extend(pipe_mgr.get_main_endpoints())
LOG.debug("Loading manager endpoints for [%s].", pipe_mgr)
endpoint = pipe_mgr.get_main_endpoints()
LOG.debug("Loaded endpoints [%s] for manager [%s].",
endpoint, pipe_mgr)
endpoints.extend(endpoint)
targets = self.get_targets()
urls = self.conf.notification.messaging_urls or [None]

View File

@ -38,10 +38,15 @@ class SampleEndpoint(base.NotificationEndpoint):
def process_notifications(self, priority, notifications):
for message in notifications:
try:
LOG.debug("Processing sample notification [%s] for publisher "
"[%s] with priority [%s] using the agent [%s].",
message, self.publisher, priority, self)
with self.publisher as p:
p(list(self.build_sample(message)))
except Exception:
LOG.error('Fail to process notification', exc_info=True)
except Exception as e:
LOG.error('Fail to process notification message [%s]'
% message, exc_info=True)
raise e
def build_sample(notification):
"""Build sample from provided notification."""