Class: Taskinator::Logging::Pretty

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/taskinator/logger.rb

Instance Method Summary collapse

Instance Method Details

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

Provide a call() method that returns the formatted message.



17
18
19
# File 'lib/taskinator/logger.rb', line 17

def call(severity, time, program_name, message)
  "#{time.utc.iso8601} #{::Process.pid} TID-#{Thread.current.object_id.to_s(36)}#{context} #{severity}: #{message}\n"
end

#contextObject



21
22
23
24
# File 'lib/taskinator/logger.rb', line 21

def context
  ctx = Thread.current[:taskinator_context]
  ctx ? " #{ctx}" : ''
end