clay / amphora

Middleware for Express that composes components into renderable pages
https://claycms.gitbooks.io/amphora/
MIT License
31 stars 23 forks source link

improves logging for explicitly handled errors #694

Closed mattoberle closed 3 years ago

mattoberle commented 3 years ago

This pull request incorporates elements of #693 with a few additional changes:

  1. I rebased the branch against origin/master to handle merge conflicts for existing logging updates.
  2. I removed logging in the composer.js when an error has a .status (leaving the logging up to the error handler in responses.js).
  3. I added a method to log errors with an explicit .status property at the warn (4xx) or error (5xx) level.

Change (1) pulls in a previous commit that added URLs to response logs. Change (2/3) will allow dynamic routes to return 404s/400s without logging at the error level.

mattoberle commented 3 years ago

@Tiffachow PR I incorporated your commits from #693 and combined them with some additional logging changes that were requested here. Since #693 was opened from an older fork there were conflicts with earlier changes that added url context to each response log.