aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-21 01:48:20 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-21 01:48:20 +0000
commit15b38efde8d997382da4b5e04cb9e7aaafb0fe57 (patch)
tree248d6c83ad0fa36005d2e005167cba6acf9e924d /activerecord/lib/active_record/base.rb
parent43fdbd5e1ff48f1b55963a6bf3fbbdd3f90f0d67 (diff)
downloadrails-15b38efde8d997382da4b5e04cb9e7aaafb0fe57.tar.gz
rails-15b38efde8d997382da4b5e04cb9e7aaafb0fe57.tar.bz2
rails-15b38efde8d997382da4b5e04cb9e7aaafb0fe57.zip
Benchmark logs for any level below or equal to the one specified, rather than just equal. Closes #10580 [Dan Manges]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8455 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 2a3fe1bde4..512b04bcdf 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1175,13 +1175,13 @@ module ActiveRecord #:nodoc:
# project.milestones << Milestone.find(:all)
# end
#
- # The benchmark is only recorded if the current level of the logger matches the <tt>log_level</tt>, which makes it
- # easy to include benchmarking statements in production software that will remain inexpensive because the benchmark
- # will only be conducted if the log level is low enough.
+ # The benchmark is only recorded if the current level of the logger is less than or equal to the <tt>log_level</tt>,
+ # which makes it easy to include benchmarking statements in production software that will remain inexpensive because
+ # the benchmark will only be conducted if the log level is low enough.
#
# The logging of the multiple statements is turned off unless <tt>use_silence</tt> is set to false.
def benchmark(title, log_level = Logger::DEBUG, use_silence = true)
- if logger && logger.level == log_level
+ if logger && logger.level <= log_level
result = nil
seconds = Benchmark.realtime { result = use_silence ? silence { yield } : yield }
logger.add(log_level, "#{title} (#{'%.5f' % seconds})")