Skip to content
Snippets Groups Projects
Commit ae128b10 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-190: do not log the enormous spam of tmss events by default

parent 011b4be9
No related branches found
No related tags found
1 merge request!252Resolve TMSS-190
......@@ -56,13 +56,20 @@ class TMSSEventMessageHandler(AbstractMessageHandler):
Base-type messagehandler for handling all TMSS event messages.
Typical usage is to derive your own subclass from TMSSEventMessageHandler and implement the specific on<SomeMessage> methods that you are interested in.
'''
def __init__(self, log_event_messages: bool=False) -> None:
self.log_event_messages = log_event_messages
super().__init__()
def handle_message(self, msg: EventMessage):
if not isinstance(msg, EventMessage):
raise ValueError("%s: Ignoring non-EventMessage: %s" % (self.__class__.__name__, msg))
stripped_subject = msg.subject.replace(_TMSS_EVENT_PREFIX_TEMPLATE%('',), '')
logger.info("%s %s: %s" % (self.__class__.__name__, stripped_subject, single_line_with_single_spaces(msg.content)))
if self.log_event_messages:
logger.info("%s %s: %s" % (self.__class__.__name__, stripped_subject, single_line_with_single_spaces(msg.content)))
# sorry, very big if/elif/else tree.
# it just maps all possible event subjects for all possible objects and statuses onto handler methods.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment