Skip to content

Commit

Permalink
fix: make warn_admins aprs friendly (#58)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andrewthetechie authored Apr 28, 2024
1 parent 245b2f7 commit acee0b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aprs_backend/aprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ def callback_message(self, msg: Message) -> None:
log.debug("Recieved msg %s", msg)
super().callback_message(msg)

def warn_admins(self, warning: str) -> None:
"""
Send a warning to the administrators of the bot.
For APRS this is too spammy over the airwaves, only log admin warnings to
the bots log at a warning level
:param warning: The markdown-formatted text of the message to send.
"""
log.warning(warning)

async def retry_worker(self) -> None:
"""Processes self._waiting_ack for messages we've sent that have not been acked
Expand Down

0 comments on commit acee0b0

Please sign in to comment.