vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb in radiant-0.6.9 vs vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb in radiant-0.7.0
- old
+ new
@@ -19,13 +19,15 @@
# which you can then use to compare timings when optimizing your code.
#
# 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