Skip to content

Commit acee0b0

Browse files
fix: make warn_admins aprs friendly (#58)
warn_admins can be very spammy. I had a plugin fail to load and it tried to send me 30 APRS messages with log spam. This fixes that issue by capturing the admin warnings in the errbot log and not sending it as a message
1 parent 245b2f7 commit acee0b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

aprs_backend/aprs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ def callback_message(self, msg: Message) -> None:
146146
log.debug("Recieved msg %s", msg)
147147
super().callback_message(msg)
148148

149+
def warn_admins(self, warning: str) -> None:
150+
"""
151+
Send a warning to the administrators of the bot.
152+
For APRS this is too spammy over the airwaves, only log admin warnings to
153+
the bots log at a warning level
154+
155+
:param warning: The markdown-formatted text of the message to send.
156+
"""
157+
log.warning(warning)
158+
149159
async def retry_worker(self) -> None:
150160
"""Processes self._waiting_ack for messages we've sent that have not been acked
151161

0 commit comments

Comments
 (0)