123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::LoggerThreadSafeLevel

Do not use. This module is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Concern
Defined in: activesupport/lib/active_support/logger_thread_safe_level.rb

Class Method Summary

Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#local_level (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 20

def local_level
  IsolatedExecutionState[local_level_key]
end

#local_level=(level) (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 24

def local_level=(level)
  case level
  when Integer
  when Symbol
    level = Logger::Severity.const_get(level.to_s.upcase)
  when nil
  else
    raise ArgumentError, "Invalid log level: #{level.inspect}"
  end
  if level.nil?
    IsolatedExecutionState.delete(local_level_key)
  else
    IsolatedExecutionState[local_level_key] = level
  end
end

#local_level_key (readonly, private)

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 53

attr_reader :local_level_key

Instance Method Details

#initialize

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 10

def initialize(...)
  super
  @local_level_key = :"logger_thread_safe_level_#{object_id}"
end

#initialize_copy(other)

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 15

def initialize_copy(other)
  super
  @local_level_key = :"logger_thread_safe_level_#{object_id}"
end

#level

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 40

def level
  local_level || super
end

#log_at(level)

Change the thread-local level for the duration of the given block.

[ GitHub ]

  
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 45

def log_at(level)
  old_local_level, self.local_level = local_level, level
  yield
ensure
  self.local_level = old_local_level
end