diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-06-10 13:06:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-10 13:06:44 -0400 |
commit | 1f452f9a3d0e4429f0121f69ad6a7b7d9a1c09cb (patch) | |
tree | 4598b8cf22bfeed186dd24f713b5dd235f1c951e /activesupport/lib/active_support | |
parent | 7fd477c0f53bd59549e5f4db65917284e29f9d0b (diff) | |
parent | 83f9cdb02af11896ef5c6cab5d0998cfa3757e25 (diff) | |
download | rails-1f452f9a3d0e4429f0121f69ad6a7b7d9a1c09cb.tar.gz rails-1f452f9a3d0e4429f0121f69ad6a7b7d9a1c09cb.tar.bz2 rails-1f452f9a3d0e4429f0121f69ad6a7b7d9a1c09cb.zip |
Merge pull request #25341 from kmcphillips/master
Broadcast #silence on ActiveSupport::Logger
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/logger.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/logger.rb b/activesupport/lib/active_support/logger.rb index de48e717b6..a520e8f2f6 100644 --- a/activesupport/lib/active_support/logger.rb +++ b/activesupport/lib/active_support/logger.rb @@ -55,6 +55,24 @@ module ActiveSupport logger.local_level = level if logger.respond_to?(:local_level=) super(level) if respond_to?(:local_level=) end + + define_method(:silence) do |level = Logger::ERROR, &block| + if logger.respond_to?(:silence) + logger.silence(level) do + if respond_to?(:silence) + super(level, &block) + else + block.call(level) + end + end + else + if respond_to?(:silence) + super(level, &block) + else + block.call(level) + end + end + end end end |