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



7
8
9
# File 'lib/active_support/logger_thread_safe_level.rb', line 7

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

#levelObject



27
28
29
# File 'lib/active_support/logger_thread_safe_level.rb', line 27

def level
  local_level || super
end

#local_levelObject



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

def local_level
  @local_levels[local_log_id]
end

#local_level=(level) ⇒ Object



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

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

#local_log_idObject



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

def local_log_id
  Thread.current.__id__
end