Skip to content

Commit 768d22f

Browse files
committed
fix: Improve startup failure fallback logs with failed extension summary
1 parent 1d977ed commit 768d22f

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

bot/utils/startup_reporting.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@ async def notify(self, bot: Bot, failures: Mapping[str, BaseException], channel_
1919
if not failures:
2020
return
2121

22+
failure_keys = sorted(failures.keys())
23+
failures_summary = ", ".join(failure_keys)
24+
2225
if bot.get_channel(channel_id) is None:
2326
# Can't send a message if the channel doesn't exist, so log instead
24-
log.warning("Failed to send startup failure report: mod_log channel not found.")
27+
log.error(
28+
"Failed to send startup failure report: mod_log channel %d not found. "
29+
"Startup failures (%d): %s",
30+
channel_id,
31+
len(failure_keys),
32+
failures_summary,
33+
)
2534
return
2635

2736
try:
@@ -39,8 +48,13 @@ async def notify(self, bot: Bot, failures: Mapping[str, BaseException], channel_
3948
ping_everyone=True,
4049
channel_id=channel_id
4150
)
42-
except Exception as exception:
43-
log.exception(f"Failed to send startup failure report: {exception}")
51+
except Exception:
52+
log.exception(
53+
"Failed to send startup failure report to channel %d. Startup failures (%d): %s",
54+
channel_id,
55+
len(failure_keys),
56+
failures_summary,
57+
)
4458

4559
def render(self, failures: Mapping[str, BaseException]) -> str:
4660
"""Render a human-readable message from the given failures."""

0 commit comments

Comments
 (0)