Module: LoggerSilence

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

Instance Method Summary collapse

Methods included from ActiveSupport::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.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_support/logger_silence.rb', line 15

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