jamf / scout-public

A tool to aggregate devices across multiple MDM servers
GNU General Public License v3.0
11 stars 3 forks source link

Add better error logging #7

Closed jacobschultz closed 5 years ago

jacobschultz commented 5 years ago

This task involves adding logging to the scout application to catch and document errors that occur in the web application. Scout is using a node module called Winston to do worker logging currently. (This lives in the logs/worker.log file.) It allows a log file name to be specified, as well as logging debug levels. There is also an existing log file called error.log that the worker may dump to. Make sure the time, user and exact actions performed in these scenarios is logged in case an audit would ever need to occur.

Scout controllers do a great job of catching errors that are returned from the models, but often they are only returned in the form of 500 errors to the client instead of a helpful message we can go back to and look at later.

Tasks:

  1. Configure winston to look at the log called 'error.log' that goes in the same /logs directory as other files.
  2. Add error logging to a good portion of the controllers/servers.js catch blocks. If the server is returning a 500, it should be logged.
  3. Add error logging to a good portion of the controllers/devices.js catch blocks. If the server is returning a 500, it should be logged.
  4. Add error logging to a good portion of the controllers/users.js catch blocks. If the server is returning a 500, it should be logged.
  5. Add error logging to a good portion of the controllers/reports.js catch blocks. If the server is returning a 500, it should be logged. It would also be helpful to log the state of the report in the database, and the mongo query generated / how many results where returned.

Bonus:

Pull Request Ready When:

  1. There are accurate and helpful log entries for all of the above actions that are contained in the error.log file.