Module: ActiveSupport::LoggerThreadSafeLevel
- Extended by:
- Concern
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#add(severity, message = nil, progname = nil, &block) ⇒ Object
Redefined to check severity against #level, and thus the thread-local level, rather than @level.
- #level ⇒ Object
- #local_level ⇒ Object
- #local_level=(level) ⇒ Object
-
#log_at(level) ⇒ Object
Change the thread-local level for the duration of the given block.
Methods included from Concern
append_features, class_methods, extended, included, prepend_features, prepended
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
Redefined to check severity against #level, and thus the thread-local level, rather than @level. FIXME: Remove when the minimum Ruby version supports overriding Logger#level.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb', line 50 def add(severity, = nil, progname = nil, &block) # :nodoc: severity ||= UNKNOWN progname ||= @progname return true if @logdev.nil? || severity < level if .nil? if block_given? = yield else = progname progname = @progname end end @logdev.write \ (format_severity(severity), Time.now, progname, ) end |
#level ⇒ Object
36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb', line 36 def level local_level || super end |
#local_level ⇒ Object
20 21 22 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb', line 20 def local_level IsolatedExecutionState[:logger_thread_safe_level] end |
#local_level=(level) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb', line 24 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 IsolatedExecutionState[:logger_thread_safe_level] = level end |
#log_at(level) ⇒ Object
Change the thread-local level for the duration of the given block.
41 42 43 44 45 46 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/logger_thread_safe_level.rb', line 41 def log_at(level) old_local_level, self.local_level = local_level, level yield ensure self.local_level = old_local_level end |