Various error log improvements #100

Open
l1s5 wants to merge 6 commits from l1s5/out-of-your-element:log-improvements into main
2 changed files with 4 additions and 5 deletions
Showing only changes of commit e505bfae82 - Show all commits

Render error messages in a single log statement

Getting 2 log events for every error made them a bit hard to both read
and query for in a log ingester.
l1s5 2026-10-25 08:49:34 +09:00
Signed by untrusted user: l1s5
GPG key ID: D0A90CC905B58D9B

View file

@ -113,11 +113,12 @@ async function onPacket(client, message, listen) {
await eventDispatcher.checkMissedLeaves(client, message.d) await eventDispatcher.checkMissedLeaves(client, message.d)
} catch (e) { } catch (e) {
if (firstReady) { if (firstReady) {
console.error("Failed to sync missed events. To retry, please fix this error and restart OOYE:") console.error("Failed to sync missed events. To retry, please fix this error and restart OOYE:", e)
} } else {
console.error(e) console.error(e)

Errors in this branch are caused by internet outage. Logging it is noise because it can error from just checking if anything needed to be done, even if nothing actually took place. That's why I moved this into an if branch.

Errors in this branch are caused by internet outage. Logging it is noise because it can error from just checking if anything needed to be done, even if nothing actually took place. That's why I moved this into an if branch.
} }
} }
}
} else if (message.t === "GUILD_UPDATE") { } else if (message.t === "GUILD_UPDATE") {
const guild = client.guilds.get(message.d.id) const guild = client.guilds.get(message.d.id)

View file

@ -47,9 +47,7 @@ const {reg} = require("../matrix/read-registration")
const errorReportStatus = sync.remember(() => ({lastReportedEvent: 0})) const errorReportStatus = sync.remember(() => ({lastReportedEvent: 0}))
function printError(type, source, e, payload) { function printError(type, source, e, payload) {
console.error(`Error while processing a ${type} ${source} event:`) console.error(`Error while processing a ${type} ${source} event:\n${util.inspect(e, false, 4, false)}\n${util.inspect(payload, false, 4, false)}`)
console.error(e)
console.dir(payload, {depth: null})
} }
/** @param {string} stack */ /** @param {string} stack */