Created
July 18, 2014 00:06
-
-
Save yuumi3/8b2d757a7ead586e5bfa to your computer and use it in GitHub Desktop.
Add USER_AGENT to Rails log. config/initializers/rack_logger.rb
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
module Rails | |
module Rack | |
class Logger < ActiveSupport::LogSubscriber | |
# Add UserAgent | |
def started_request_message(request) | |
'Started %s "%s" for %s at %s by %s' % [ | |
request.request_method, | |
request.filtered_path, | |
request.ip, | |
Time.now.to_default_s, | |
request.env['HTTP_USER_AGENT'] ] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment