epimorphics / json-rails-logger

A custom rails logger that outputs JSON instead of raw text
MIT License
1 stars 1 forks source link

Issue/3 request #8

Closed bogdanadrianmarc closed 3 years ago

bogdanadrianmarc commented 3 years ago

This PR is related to issue #3 . It adds a request_id field to every log message, regardless if it's a simple webpacker message or a get request message. It does that using some middleware that saves the request_id from action_dispatch in the current thread and retrieving it in the formatter. Normally the request_id gets passed only to log messages that have request info, rather than all the log message, but that changes with the use of the middleware; now every message has it, so it makes it much easier to trace log messages related to a certain request. Also, locally tests pass, so this should be the case here too