spike-2 / Spike-2

Server specific Discord bot
https://spike-2.github.io
1 stars 0 forks source link

Log errors and debug info to file #19

Closed brandoningli closed 2 years ago

brandoningli commented 3 years ago

Is your feature request related to a problem? Please describe.

Errors can be hard to track down in the terminal output.

Describe the solution you'd like

Log errors and other debug info to a file for easy future inspection.

Describe alternatives you've considered

Additional context

brandoningli commented 3 years ago

We can either try overriding console or making our own logger and replace all instances.

brandoningli commented 3 years ago
brandoningli commented 3 years ago

I'd highly recommend looking into an existing nodejs library for logging. Should give us more granular control over logging levels, rotating log files, log to a file and the console at the same time (maybe colorized), and potentially give us the option to log to something like a Graylog server in the future easily. The winston library looks like it could be a winner. See also this article that talks about Winston, but ignore the parts specific to adding Loggly logging handlers.

brandoningli commented 2 years ago

Adding some information about winston and the log level guidelines to a wiki page.