From 96e2cb33ba349aea5d3e8589aad883e21b27e109 Mon Sep 17 00:00:00 2001 From: Andrew Mirsky Date: Mon, 16 Jun 2025 08:20:59 -0400 Subject: [PATCH] noisy log messages hide errors and warnings --- amqtt/plugins/logging_amqtt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amqtt/plugins/logging_amqtt.py b/amqtt/plugins/logging_amqtt.py index 13b0f20..3355d58 100644 --- a/amqtt/plugins/logging_amqtt.py +++ b/amqtt/plugins/logging_amqtt.py @@ -3,6 +3,7 @@ from functools import partial import logging from typing import TYPE_CHECKING, Any +from amqtt.events import BrokerEvents from amqtt.plugins.base import BasePlugin from amqtt.plugins.manager import BaseContext @@ -16,7 +17,10 @@ class EventLoggerPlugin(BasePlugin[BaseContext]): async def log_event(self, *args: Any, **kwargs: Any) -> None: """Log the occurrence of an event.""" event_name = kwargs["event_name"].replace("old", "") - self.context.logger.info(f"### '{event_name}' EVENT FIRED ###") + if event_name.replace("on_", "") in (BrokerEvents.CLIENT_CONNECTED, BrokerEvents.CLIENT_DISCONNECTED): + self.context.logger.info(f"### '{event_name}' EVENT FIRED ###") + else: + self.context.logger.debug(f"### '{event_name}' EVENT FIRED ###") def __getattr__(self, name: str) -> Callable[..., Coroutine[Any, Any, None]]: """Dynamically handle calls to methods starting with 'on_'."""