Sha256: 8bfa328abd06c512c412bc5ed4d980acf987ff635865142592b0f198e8b49b0e

Contents?: true

Size: 480 Bytes

Versions: 108

Compression:

Stored size: 480 Bytes

Contents

require 'active_support/concern'

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_logger_level, self.level = level, temporary_level
        yield self
      ensure
        self.level = old_logger_level
      end
    else
      yield self
    end
  end
end

Version data entries

108 entries across 103 versions & 10 rubygems

Version Path
activesupport-4.1.14.2 lib/active_support/logger_silence.rb
activesupport-4.2.5.2 lib/active_support/logger_silence.rb
activejob-lock-0.0.2 rails/activesupport/lib/active_support/logger_silence.rb
activesupport-4.2.5.1 lib/active_support/logger_silence.rb
activesupport-4.1.14.1 lib/active_support/logger_silence.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/logger_silence.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/activesupport-4.2.4/lib/active_support/logger_silence.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/activesupport-4.2.4/lib/active_support/logger_silence.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/logger_silence.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/logger_silence.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/logger_silence.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/logger_silence.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/activesupport-4.2.4/lib/active_support/logger_silence.rb
activesupport-4.1.14 lib/active_support/logger_silence.rb
activesupport-4.2.5 lib/active_support/logger_silence.rb
activesupport-4.2.5.rc2 lib/active_support/logger_silence.rb
activesupport-4.1.14.rc2 lib/active_support/logger_silence.rb
activesupport-4.2.5.rc1 lib/active_support/logger_silence.rb
activesupport-4.1.14.rc1 lib/active_support/logger_silence.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/logger_silence.rb