cjs8487 / PlayBingo

A comprehensive speedrun bingo service
https://playbingo.gg
0 stars 5 forks source link

Improved Logging #38

Closed cjs8487 closed 2 months ago

cjs8487 commented 2 months ago

Improves application logging. All API requests are now logged, including basic metadata, including IP address, user agent, session id, and performance data. The logger will also now catch and log uncaught exceptions and unhandled promise rejections, which will prevent the application from crashing.

The logs function as follows. All logs are always saved to a default file based transport. This transport only logs messages at the info level or higher. When the testing environment flag is set, an additional console transport will be added to the logger, which will log all messages in a readable form to the console. The console transport does not log any request metadata. When the testing flag is set, the logger will also be set to log all messages at level silly or above. This allows us to easily log useful information for development without bloating the actual log files in production. The file transport is configured to rotate the log file daily, compressing archived log files. Log files will kept for one week before being deleted automatically by the system.

This also introduces the Staff Dashboard board /staff, which currently only contains a log viewer. The log viewer allows users with the staff flag on their user on their account to view the logs from the current day, and contains some convenience filters for log level and associated room. The staff dashboard is set up to use Next's slot feature, allowing simple dashboard functionality. As more functionality is aded to the staff dashboard, the layout should be revisited in order to better leverage the slot functionality of rendering multiple routes in parallel