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



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

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

#levelObject



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

def level
  local_level || super
end

#local_levelObject



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

def local_level
  @local_levels[local_log_id]
end

#local_level=(level) ⇒ Object



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

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

#local_log_idObject



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

def local_log_id
  Thread.current.__id__
end