Module: ActiveSupport::LoggerThreadSafeLevel

Extended by:
Concern
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

#add(severity, message = nil, progname = nil, &block) ⇒ Object

:nodoc:



51
52
53
54
# File 'lib/active_support/logger_thread_safe_level.rb', line 51

def add(severity, message = nil, progname = nil, &block) # :nodoc:
  return true if @logdev.nil? || (severity || UNKNOWN) < level
  super
end

#after_initializeObject



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

def after_initialize
  ActiveSupport::Deprecation.warn(
    "Logger don't need to call #after_initialize directly anymore. It will be deprecated without replacement in " \
    "Rails 6.1."
  )
end

#levelObject



47
48
49
# File 'lib/active_support/logger_thread_safe_level.rb', line 47

def level
  local_level || super
end

#local_levelObject



35
36
37
# File 'lib/active_support/logger_thread_safe_level.rb', line 35

def local_level
  self.class.local_levels[local_log_id]
end

#local_level=(level) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/active_support/logger_thread_safe_level.rb', line 39

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

#local_log_idObject



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

def local_log_id
  Fiber.current.__id__
end