Improve performance of the Logger middleware by using simpler versions of methods
This commit is contained in:
parent
8b05c5207d
commit
67a2d648d8
|
@ -1,4 +1,5 @@
|
||||||
require 'rails/log_subscriber'
|
require 'rails/log_subscriber'
|
||||||
|
require 'active_support/core_ext/time/conversions'
|
||||||
|
|
||||||
module Rails
|
module Rails
|
||||||
module Rack
|
module Rack
|
||||||
|
@ -19,10 +20,10 @@ module Rails
|
||||||
|
|
||||||
def before_dispatch(env)
|
def before_dispatch(env)
|
||||||
request = ActionDispatch::Request.new(env)
|
request = ActionDispatch::Request.new(env)
|
||||||
path = request.fullpath.inspect rescue "unknown"
|
path = request.fullpath
|
||||||
|
|
||||||
info "\n\nStarted #{request.method.to_s.upcase} #{path} " <<
|
info "\n\nStarted #{env["REQUEST_METHOD"]} \"#{path}\" " \
|
||||||
"for #{request.remote_ip} at #{Time.now.to_s(:db)}"
|
"for #{request.ip} at #{Time.now.to_default_s}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_dispatch(env)
|
def after_dispatch(env)
|
||||||
|
|
Loading…
Reference in New Issue