Created
April 27, 2012 20:59
-
-
Save qrush/2513183 to your computer and use it in GitHub Desktop.
Rails 3.2 Tagged Logger examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# somewhere in your middleware stack... | |
# request.env['yourapp.someid'] = "1337" | |
YourApp::Application.configure do | |
config.log_tags = [ | |
-> request { | |
request.env['yourapp.someid'] | |
} | |
] | |
end | |
# [1337] Processing by ProjectsController#index as HTML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YourApp::Application.configure do | |
config.log_tags = ["Static"] | |
end | |
# [Static] Processing by ProjectsController#index as HTML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YourApp::Application.configure do | |
config.log_tags = [:uuid] | |
end | |
# [71ba53fd717c67a6677a058f4a5acdf4] Processing by ProjectsController#index as HTML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you haven't checked it out, I found this was looking for various ways of inserting request_id and user_id, I ended up moving our app to lograge and using some custom event data. Look at the section on "You can also add a hook for own custom data"
https://github.com/roidrage/lograge
basically the flow for any variables is below
then set the custom var in
application_controller.rb