aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/benchmark_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/benchmark_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/benchmark_helper.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/benchmark_helper.rb b/actionpack/lib/action_view/helpers/benchmark_helper.rb
index fefa28f4d7..c278a38f25 100644
--- a/actionpack/lib/action_view/helpers/benchmark_helper.rb
+++ b/actionpack/lib/action_view/helpers/benchmark_helper.rb
@@ -21,11 +21,13 @@ module ActionView
# You may give an optional logger level as the second argument
# (:debug, :info, :warn, :error); the default value is :info.
def benchmark(message = "Benchmarking", level = :info)
- if @logger
+ if controller.logger
real = Benchmark.realtime { yield }
- @logger.send level, "#{message} (#{'%.5f' % real})"
+ controller.logger.send level, "#{message} (#{'%.5f' % real})"
+ else
+ yield
end
end
end
end
-end
+end \ No newline at end of file