Class: Soda::Logger::Formatter
- Inherits:
-
Object
- Object
- Soda::Logger::Formatter
show all
- Includes:
- Tools
- Defined in:
- lib/soda/logger.rb
Constant Summary
collapse
- CONTEXT_KEY =
:_soda_log_context
Constants included
from Tools
Tools::TID_KEY
Instance Method Summary
collapse
Methods included from Tools
#deep_symbolize_keys, #logger, #now, #sqs, #tid
Instance Method Details
#call(severity, time, _, message) ⇒ Object
8
9
10
11
12
|
# File 'lib/soda/logger.rb', line 8
def call(severity, time, _, message)
context = format_context(severity, time)
"%s %s\n" % [context, message]
end
|
#context ⇒ Object
14
15
16
|
# File 'lib/soda/logger.rb', line 14
def context
Thread.current[CONTEXT_KEY] || []
end
|
#context=(ctx) ⇒ Object
18
19
20
|
# File 'lib/soda/logger.rb', line 18
def context=(ctx)
Thread.current[CONTEXT_KEY] = ctx
end
|