-
-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
Description
Environment
Provide at least:
- Ruby Version: 2.6.5
- Rails Version: 6.0.2.2
- Semantic Logger Version: 4.6.1
- Rails Semantic Logger Version: 4.4.3
With regard to the Name Tags:
Named Tags
Named tags can be added to every log message on a per web request basis, by overriding the Rails built-in config.log_tags with a hash value.
I want to add user_id to every log message
config.log_tags = {
user_id: -> controller.current_user_id.present? "#{controller.current_user_id}" : 'guest'
}However, it seems that I can't access the controller in there.
Adding custom data to the Rails Completed log message
During Controller-action processing custom data can be added to the Rails Completed message.
To access controller we can use payload but I want to add this information on every log. Not just custom data. It's something in between Named Tags (added on every log message) and Payload (controller accessible).
It would be nice if I can add an additional log to Rails's default system log. 🤔