I don't see any direct way to hook this up to an error logger.
The formatError isn't really what I am looking as I cant connect the error to a request that way.
I am thinking this must be an oversight on my part, as surely if one is running this in production, you would want to log errors. But I cant find any documentations or guides how todo this.
See my solution with formatError https://gist.github.com/nodkz/d7caf219dcb6e65b94900a9f549bf9d0
If the errors array has multiple items the solution with formatError will create multiple log entries for the same request. This is not desirable for log analytics.
Is there any better solution to this?
Most helpful comment
See my solution with formatError https://gist.github.com/nodkz/d7caf219dcb6e65b94900a9f549bf9d0