Log every single request

Hi there,

I want to log every single request, do I have to put something like this:

Logger.info('request details %j', {
  url: request.url(),
  user: auth.user.username()

in each controller method?

Is there a better way? Make sense wrapper Logger class into middleware?

Best regards.

I think middleware would make sense in there.
A lot cleaner than adding it into every controller method.

1 Like