Module: ActiveSupport::LoggerThreadSafeLevel

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

Instance Method Summary collapse

Methods included from Concern

append_features, class_methods, extended, included

Instance Method Details

#after_initializeObject


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

def after_initialize
  @local_levels = ThreadSafe::Cache.new
end

#levelObject


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

def level
  local_level || super
end

#local_levelObject


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

def local_level
  @local_levels[local_log_id]
end

#local_level=(level) ⇒ Object


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

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

#local_log_idObject


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

def local_log_id
  Thread.current.__id__
end