Tagged logging is nice, and with config.log_tags
, it’s a great way to include stuff from the request in all log messages automatically.
However: it would also be nice to have a way to include information from CurrentAttribtues
. The main use-case for this is to get the “auto include useful info” functionality when running outside of a controller, for example inside a model, service, or background job.
I have looked at the code for tagged logging and can’t see an obvious way to achieve this. I’m not asking “how could Rails be changed to add this feature?” but more like “is there a configuration I can set up in my app to achieve this?”