Sha256: dadfb39427ab4ac6ba370188eaf68bba110a25a8a65026238c0eb94ddf0b5a61

Contents?: true

Size: 547 Bytes

Versions: 19

Compression:

Stored size: 547 Bytes

Contents

require 'active_support/concern'
require 'thread_safe'

module LoggerSilence
  extend ActiveSupport::Concern

  included do
    cattr_accessor :silencer
    self.silencer = true
  end

  # Silences the logger for the duration of the block.
  def silence(temporary_level = Logger::ERROR)
    if silencer
      begin
        old_local_level            = local_level
        self.local_level           = temporary_level

        yield self
      ensure
        self.local_level = old_local_level
      end
    else
      yield self
    end
  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
activesupport-4.2.11.3 lib/active_support/logger_silence.rb
activesupport-4.2.11.2 lib/active_support/logger_silence.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/logger_silence.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/logger_silence.rb
activesupport-4.2.11.1 lib/active_support/logger_silence.rb
activesupport-4.2.11 lib/active_support/logger_silence.rb
activesupport-4.2.10 lib/active_support/logger_silence.rb
activesupport-4.2.10.rc1 lib/active_support/logger_silence.rb
activesupport-4.2.9 lib/active_support/logger_silence.rb
activesupport-4.2.9.rc2 lib/active_support/logger_silence.rb
activesupport-4.2.9.rc1 lib/active_support/logger_silence.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-4.2.8/lib/active_support/logger_silence.rb
activesupport-4.2.8 lib/active_support/logger_silence.rb
activesupport-4.2.8.rc1 lib/active_support/logger_silence.rb
neo4j_legacy-7.2.0.2 lib/backports/active_support/logger_silence.rb
neo4j_legacy-7.2.0.1 lib/backports/active_support/logger_silence.rb
activesupport-4.2.7.1 lib/active_support/logger_silence.rb
activesupport-4.2.7 lib/active_support/logger_silence.rb
activesupport-4.2.7.rc1 lib/active_support/logger_silence.rb