grape_logging icon indicating copy to clipboard operation
grape_logging copied to clipboard

Pass status code to loggers

Open stanhu opened this issue 5 years ago • 1 comments

Right now the loggers only have access to the request and response_body, but it would be nice to have access to the status code as well. For now, we're working around the problem by storing the intended status code in the request.env, but this is not ideal.

Not sure the best way to support this without breaking compatibility of the parameters call in https://github.com/aserafin/grape_logging/blob/fd8d2d457f5eca20664d9e2c8eb2885837fa68ed/lib/grape_logging/middleware/request_logger.rb#L140. We could check if the signature accepts an optional 3rd argument?

stanhu avatar Apr 18 '20 04:04 stanhu

This might be a better place for the discussion I just started in #45 and it's implemented in #80 should we decide to do it. I think it makes sense too.

samsonjs avatar Jun 28 '25 11:06 samsonjs