diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-08 10:50:28 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-01-09 15:34:58 -0800 |
commit | 23b69c95ac24b6c0faf682e0f8a1f9acc53f43f8 (patch) | |
tree | c2eb794453dff9b63396ef2badef402a8c05950e | |
parent | 56f3d05f4746c091827d7607f0afe2857959c73c (diff) | |
download | rails-23b69c95ac24b6c0faf682e0f8a1f9acc53f43f8.tar.gz rails-23b69c95ac24b6c0faf682e0f8a1f9acc53f43f8.tar.bz2 rails-23b69c95ac24b6c0faf682e0f8a1f9acc53f43f8.zip |
extract logger and development checks to methods
-rw-r--r-- | railties/lib/rails/rack/logger.rb | 22 |
1 files changed, 16 insertions, 6 deletions
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 |