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, extended, included

Instance Method Details

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

Silences the logger for the duration of the block.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_support/logger_silence.rb', line 12

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