Module: Cosmo::Logger::Context
- Defined in:
- lib/cosmo/logger.rb,
sig/cosmo/logger.rbs
Constant Summary collapse
- KEY =
:cosmo_context
Class Method Summary collapse
Class Method Details
.current ⇒ Hash[Symbol, untyped]
26 27 28 29 |
# File 'lib/cosmo/logger.rb', line 26 def self.current Thread.current[KEY] ||= {} Thread.current[KEY] end |
.with(**options) ⇒ void
This method returns an undefined value.
13 14 15 16 17 18 19 |
# File 'lib/cosmo/logger.rb', line 13 def self.with(**) prev = current Thread.current[KEY] = prev.merge() yield if block_given? ensure Thread.current[KEY] = prev if block_given? end |
.without(*keys) ⇒ nil
21 22 23 24 |
# File 'lib/cosmo/logger.rb', line 21 def self.without(*keys) Thread.current[KEY] = current.except(*keys) nil end |