Class: Wurk::Logger::Formatters::JSON

Inherits:
Base
  • Object
show all
Defined in:
lib/wurk/logger.rb

Instance Method Summary collapse

Instance Method Details

#call(severity, time, _program_name, message) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/wurk/logger.rb', line 94

def call(severity, time, _program_name, message)
  hash = {
    ts: time.utc.iso8601(3),
    pid: PidCache.pid,
    tid: tid,
    lvl: severity,
    msg: message
  }
  ctx = Wurk::Context.current
  hash[:ctx] = ctx unless ctx.empty?
  "#{::JSON.generate(hash)}\n"
end