Various error log improvements #100

Open
l1s5 wants to merge 6 commits from l1s5/out-of-your-element:log-improvements into main
Showing only changes of commit 2a34e797c3 - Show all commits

Make discord client log disconnections and errors outside CONNECTION_DEBUG

These logs are useful in production environments, when investigating
unexpected downtime and incidents.
l1s5 2026-10-25 21:33:56 +09:00
Signed by untrusted user: l1s5
GPG key ID: D0A90CC905B58D9B

View file

@ -62,7 +62,6 @@ class DiscordClient {
}) })
} }
if (CONNECTION_DEBUG) {
const addEventLogger = (eventName, logName) => { const addEventLogger = (eventName, logName) => {
this.cloud.on(eventName, (...args) => { this.cloud.on(eventName, (...args) => {
const d = new Date().toISOString().slice(0, 19) const d = new Date().toISOString().slice(0, 19)
@ -71,6 +70,7 @@ class DiscordClient {
} }
addEventLogger("error", "Error") addEventLogger("error", "Error")
addEventLogger("disconnected", "Disconnected") addEventLogger("disconnected", "Disconnected")

I don't want to move these outside of the CONNECTION_DEBUG filter because printing "disconnected" and not printing anything after it comes back online makes the situation look bad when there was actually no issue.

If there are actually any connection reliability issues in Cloudstorm (which I think we've dealt with, because I haven't seen any in many months) then more logging is needed to diagnose those anyway.

I don't want to move these outside of the CONNECTION_DEBUG filter because printing "disconnected" and _not printing anything after it comes back online_ makes the situation look bad when there was actually no issue. If there are actually any connection reliability issues in Cloudstorm (which I think we've dealt with, because I haven't seen any in many months) then more logging is needed to diagnose those anyway.
if (CONNECTION_DEBUG) {
addEventLogger("ready", "Ready") addEventLogger("ready", "Ready")
} }
} }