Various error log improvements #100
2 changed files with 4 additions and 5 deletions
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.
commit
e505bfae82
|
|
@ -113,9 +113,10 @@ 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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue
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.