123456789_123456789_123456789_123456789_123456789_

Module: LoggerSilence

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activesupport/lib/active_support/logger_silence.rb

Class Method Summary

Instance Method Summary

DSL Calls

included

[ GitHub ]


7
8
9
10
# File 'activesupport/lib/active_support/logger_silence.rb', line 7

included do
  cattr_accessor :silencer
  self.silencer = true
end

Instance Method Details

#silence(temporary_level = Logger::ERROR)

Silences the logger for the duration of the block.

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_silence.rb', line 13

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