Module: ActiveSupport::LoggerSilence

Extended by:
Concern
Included in:
Logger
Defined in:
lib/active_support/logger_silence.rb

Instance Method Summary collapse

Methods included from Concern

append_features, class_methods, extended, included

Instance Method Details

#silence(temporary_level = Logger::ERROR) ⇒ Object

Silences the logger for the duration of the block.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/active_support/logger_silence.rb', line 30

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