From 270d7df9aec34e47e429cc4f6b8d60583b9b6d5f Mon Sep 17 00:00:00 2001 From: disqualifier Date: Sun, 9 Aug 2026 02:14:11 -0400 Subject: [PATCH] fix: discord send failure logs WARNING, not ERROR (D4) _send mirrors the record to the stdlib sink BEFORE attempting the discord send, so a swallowed send failure is recovered cleanly - the log survives, only the channel mirror was lost. that is a WARNING (recovered), not an ERROR. demote from _log.exception (ERROR + traceback) to _log.warning with the reason folded in lazily; the traceback belonged on a terminal/unhandled path, and this one recovers via the guaranteed stdlib record. Signed-off-by: disqualifier --- src/dpy_logger/dpy_logger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dpy_logger/dpy_logger.py b/src/dpy_logger/dpy_logger.py index 0ee6d41..be839a2 100644 --- a/src/dpy_logger/dpy_logger.py +++ b/src/dpy_logger/dpy_logger.py @@ -213,8 +213,11 @@ class DPYLogger: content=content, embed=self.build_embed(level, action, actor, log_msg), ) - except Exception: - _log.exception(f"[dpy_logger] failed to send {level} log: {log_msg}") + except Exception as exc: + # WARNING, not ERROR: the record was already mirrored to the stdlib sink BEFORE the + # send (see _emit_stdlib above), so a swallowed discord-send failure is recovered + # cleanly - the log survives, only the channel mirror was lost. lazy interpolation. + _log.warning("[dpy_logger] failed to send %s log: %s (%s)", level, log_msg, exc) return None async def debug(self, log, action=None, actor=None, guild=None, log_to_file=None):