Replaced every console.log in the bot with a leveled logger.
The old setup was five files each printing things like “Message received!”, “Responding…”, and “Messages saved!” with no way to tell which file was talking or which run produced which line. Replaced it all with a single Code/Logger.js that adds timestamps, severity (debug/info/warn/error), a subsystem tag per file, and structured metadata. Errors now print a full stack trace on a second dimmed line instead of [object Object].
The visual difference is the whole point. Before, /bigbrother-loyalty produced four console.log lines with no correlation. After, it produces one timestamped line per stage — fetch, score, scoreboard write — and you can grep by subsystem or level.
The interesting bug: my first Logger.js had a guard that re-checked whether meta was undefined, but I also had a fallback that promoted a non-Error second argument into meta. The two branches collided and swallowed the error stack entirely. Caught it in a two-line test snippet before staging, would have been invisible until the first real API failure.
Also stopped logging the full Hugging Face response on every sentiment check. Now it only prints the per-label scores rounded to three decimals, same diagnostic value, way less noise.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.