Sha256: 66e7f53a10fd3b713f4e34dd521dae26819926264d5d364bf1060226ec84ed22

Contents?: true

Size: 628 Bytes

Versions: 48

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"
require "active_support/core_ext/module/attribute_accessors"
require "concurrent"

module LoggerSilence
  extend ActiveSupport::Concern

  included do
    cattr_accessor :silencer, default: 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

48 entries across 48 versions & 7 rubygems

Version Path
activesupport-5.2.8.1 lib/active_support/logger_silence.rb
activesupport-5.2.8 lib/active_support/logger_silence.rb
activesupport-5.2.7.1 lib/active_support/logger_silence.rb
activesupport-5.2.7 lib/active_support/logger_silence.rb
activesupport-5.2.6.3 lib/active_support/logger_silence.rb
activesupport-5.2.6.2 lib/active_support/logger_silence.rb
activesupport-5.2.6.1 lib/active_support/logger_silence.rb
activesupport-5.2.6 lib/active_support/logger_silence.rb
activesupport-5.2.4.6 lib/active_support/logger_silence.rb
activesupport-5.2.5 lib/active_support/logger_silence.rb
activesupport-5.2.4.5 lib/active_support/logger_silence.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.1/lib/active_support/logger_silence.rb
activesupport-5.2.4.4 lib/active_support/logger_silence.rb
activesupport-5.2.4.3 lib/active_support/logger_silence.rb
activesupport-5.2.4.2 lib/active_support/logger_silence.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/logger_silence.rb
activesupport-5.2.4.1 lib/active_support/logger_silence.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_silence.rb
activesupport-5.2.4 lib/active_support/logger_silence.rb
activesupport-5.2.4.rc1 lib/active_support/logger_silence.rb