Module: ActiveSupport::LoggerThreadSafeLevel

Extended by:
Concern
Included in:
Logger
Defined in:
lib/active_support/logger_thread_safe_level.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Concern

append_features, class_methods, extended, included

Instance Method Details

#after_initializeObject



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

def after_initialize
  @local_levels = Concurrent::Map.new(initial_capacity: 2)
end

#levelObject



30
31
32
# File 'lib/active_support/logger_thread_safe_level.rb', line 30

def level
  local_level || super
end

#local_levelObject



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

def local_level
  @local_levels[local_log_id]
end

#local_level=(level) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/active_support/logger_thread_safe_level.rb', line 22

def local_level=(level)
  if level
    @local_levels[local_log_id] = level
  else
    @local_levels.delete(local_log_id)
  end
end

#local_log_idObject



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

def local_log_id
  Fiber.current.__id__
end