module ActiveSupport::LoggerSilence

Public Instance Methods

silence(temporary_level = Logger::ERROR) { |self| ... } Show source
# File activesupport/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

Silences the logger for the duration of the block.

© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.