Module: LogSinks::MDC
- Defined in:
- lib/log_sinks/mdc.rb
Overview
Mapped Diagnostic Context (MDC) is thread-aware Hash-like storage to add extra context details to logged events.
Constant Summary collapse
- SYNC_MUTEX =
Mutex.new
Class Method Summary collapse
- .[]=(key, value) ⇒ Object
- .any? ⇒ Boolean
- .clear(key) ⇒ Object
- .items ⇒ Object
- .store(key, value) ⇒ Object
Class Method Details
.[]=(key, value) ⇒ Object
9 10 11 |
# File 'lib/log_sinks/mdc.rb', line 9 def []=(key, value) context[key] = value end |
.any? ⇒ Boolean
22 23 24 |
# File 'lib/log_sinks/mdc.rb', line 22 def any? context.any? end |
.clear(key) ⇒ Object
13 14 15 16 |
# File 'lib/log_sinks/mdc.rb', line 13 def clear(key) context.delete(key) nil end |
.items ⇒ Object
26 27 28 |
# File 'lib/log_sinks/mdc.rb', line 26 def items context.dup.freeze end |
.store(key, value) ⇒ Object
18 19 20 |
# File 'lib/log_sinks/mdc.rb', line 18 def store(key, value) MDC[key] = value end |