From 23b69c95ac24b6c0faf682e0f8a1f9acc53f43f8 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Jan 2013 10:50:28 -0800 Subject: extract logger and development checks to methods --- railties/lib/rails/rack/logger.rb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb index 7be2333981..78b4e68ce4 100644 --- a/railties/lib/rails/rack/logger.rb +++ b/railties/lib/rails/rack/logger.rb @@ -12,8 +12,8 @@ module Rails def call(env) request = ActionDispatch::Request.new(env) - if Rails.logger.respond_to?(:tagged) - Rails.logger.tagged(compute_tags(request)) { call_app(request, env) } + if logger.respond_to?(:tagged) + logger.tagged(compute_tags(request)) { call_app(request, env) } else call_app(request, env) end @@ -23,12 +23,12 @@ module Rails def call_app(request, env) # Put some space between requests in development logs. - if Rails.env.development? - Rails.logger.debug '' - Rails.logger.debug '' + if development? + logger.debug '' + logger.debug '' end - Rails.logger.info started_request_message(request) + logger.info started_request_message(request) @app.call(env) ensure ActiveSupport::LogSubscriber.flush_all! @@ -55,6 +55,16 @@ module Rails end end end + + private + + def development? + Rails.env.development? + end + + def logger + Rails.logger + end end end end -- cgit v1.2.3