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:
Configure winston to look at the log called 'error.log' that goes in the same /logs directory as other files.
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.
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.
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.
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:
Express has quite powerful middleware functions that could make the job of this logging easier, and less messy in the controllers. While not required to close this issue, it would be cool to setup middleware to catch errors that then does all of the logging in that file instead of the controllers.
Pull Request Ready When:
There are accurate and helpful log entries for all of the above actions that are contained in the error.log file.
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 thelogs/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 callederror.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:
controllers/servers.js
catch blocks. If the server is returning a 500, it should be logged.controllers/devices.js
catch blocks. If the server is returning a 500, it should be logged.controllers/users.js
catch blocks. If the server is returning a 500, it should be logged.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: