edge badge
Methods
A
L
S
Instance Public methods
after_initialize()
# File activesupport/lib/active_support/logger_silence.rb, line 14
def after_initialize
  @local_levels = Concurrent::Map.new(:initial_capacity => 2)
end
level()
# File activesupport/lib/active_support/logger_silence.rb, line 22
def level
  local_levels[local_log_id] || super
end
local_log_id()
# File activesupport/lib/active_support/logger_silence.rb, line 18
def local_log_id
  Thread.current.__id__
end
silence(temporary_level = Logger::ERROR)

Silences the logger for the duration of the block.

# File activesupport/lib/active_support/logger_silence.rb, line 27
def silence(temporary_level = Logger::ERROR)
  if silencer
    begin
      old_local_level            = local_levels[local_log_id]
      local_levels[local_log_id] = temporary_level

      yield self
    ensure
      if old_local_level
        local_levels[local_log_id] = old_local_level
      else
        local_levels.delete(local_log_id)
      end
    end
  else
    yield self
  end
end