Module: ActiveSupport::LoggerThreadSafeLevel
Do not use. This module is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Concern
|
|
Defined in: | activesupport/lib/active_support/logger_thread_safe_level.rb |
Class Method Summary
Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |
append_features, prepend_features |
Instance Attribute Summary
Instance Method Summary
- #level
-
#log_at(level)
Change the thread-local level for the duration of the given block.
- #local_level_key private
Instance Attribute Details
#local_level (rw)
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 10
def local_level IsolatedExecutionState[local_level_key] end
#local_level=(level) (rw)
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 14
def local_level=(level) case level when Integer when Symbol level = Logger::Severity.const_get(level.to_s.upcase) when nil else raise ArgumentError, "Invalid log level: #{level.inspect}" end if level.nil? IsolatedExecutionState.delete(local_level_key) else IsolatedExecutionState[local_level_key] = level end end
Instance Method Details
#level
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 30
def level local_level || super end
#local_level_key (private)
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 43
def local_level_key @local_level_key ||= :"logger_thread_safe_level_#{object_id}" end
#log_at(level)
Change the thread-local level for the duration of the given block.
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 35
def log_at(level) old_local_level, self.local_level = local_level, level yield ensure self.local_level = old_local_level end