Skip to content

Instantly share code, notes, and snippets.

@yuumi3
Created July 18, 2014 00:06
Show Gist options
  • Save yuumi3/8b2d757a7ead586e5bfa to your computer and use it in GitHub Desktop.
Save yuumi3/8b2d757a7ead586e5bfa to your computer and use it in GitHub Desktop.
Add USER_AGENT to Rails log. config/initializers/rack_logger.rb
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