Module: LoggerSilence
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | activesupport/lib/active_support/logger_silence.rb |
Class Method Summary
::ActiveSupport::Concern - Extended
Instance Method Summary
-
#silence(temporary_level = Logger::ERROR)
Silences the logger for the duration of the block.
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.
# 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