💡 Use proper logging
Describe the improvement
One of Needle's shards stopped reconnecting today after 8 days of uptime. Unfortunately we only write errors straight to console right now, so I don't really know what happened. It's about time we invest some time in an actual logging system that saves logs on disk (without having too much of a performance impact).
Logs only need to be stored for like, 48 hours tops. 24h would also be fine. Anything less and I might be asleep when the important error happened.
We should also listen to the following DJS events:
-
debug -
shardError -
warn
Problems this improvement solves
We know why errors happen and can act on it.
Alternative solutions
I'd love to hear suggestions on logging libraries and perhaps good (free) remote log services too.
On first glance https://github.com/winstonjs/winston seems popular?
https://github.com/pinojs/pino seems like it has less overhead and is more active? And better docs https://getpino.io/#/docs/benchmarks
With https://github.com/MarcusOtter/discord-needle/commit/7610168453b6d8622e577131b35adb8039dada0f we listen to the events