Module: RJack::SLF4J::MDC
- Defined in:
- lib/rjack-slf4j/mdc.rb
Overview
Mapped Diagnostic Context support module
Note that this optional module can only be loaded after a output adapter has been loaded. Otherwise the following output is printed and Exception will be thrown:
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticMDCBinder
Class Method Summary collapse
-
.[](key) ⇒ Object
Get value associated with key, or nil.
-
.[]=(key, val) ⇒ Object
Associate val with key, or remove key is value is nil.
Class Method Details
.[](key) ⇒ Object
Get value associated with key, or nil.
34 35 36 |
# File 'lib/rjack-slf4j/mdc.rb', line 34 def self.[]( key ) org.slf4j.MDC::get( key.to_s ) end |
.[]=(key, val) ⇒ Object
Associate val with key, or remove key is value is nil.
39 40 41 42 43 44 45 |
# File 'lib/rjack-slf4j/mdc.rb', line 39 def self.[]=( key, val ) if val org.slf4j.MDC::put( key.to_s, val.to_s ) else org.slf4j.MDC::remove( key.to_s ) end end |