diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-02 08:31:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-02 08:31:26 +0000 |
commit | aec31cd09f12fcda128582ef5bfbe25bb87db644 (patch) | |
tree | 8e6a166b5a18dc524a0210016454f82b347049fa /activerecord/lib/active_record/base.rb | |
parent | 06a6133fff7ddac177dde63c3303e1209c9e5518 (diff) | |
download | rails-aec31cd09f12fcda128582ef5bfbe25bb87db644.tar.gz rails-aec31cd09f12fcda128582ef5bfbe25bb87db644.tar.bz2 rails-aec31cd09f12fcda128582ef5bfbe25bb87db644.zip |
Fixed Base.silence/benchmark to only log if a logger has been configured #986 [skaes@web.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1059 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d15b7e9986..8d548ec8a2 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -687,16 +687,16 @@ module ActiveRecord #:nodoc: def benchmark(title) result = nil bm = Benchmark.measure { result = silence { yield } } - logger.info "#{title} (#{sprintf("%f", bm.real)})" + logger.info "#{title} (#{sprintf("%f", bm.real)})" if logger return result end # Silences the logger for the duration of the block. def silence result = nil - logger.level = Logger::ERROR + logger.level = Logger::ERROR if logger result = yield - logger.level = Logger::DEBUG + logger.level = Logger::DEBUG if logger return result end |