Class: Subserver::Logging::Pretty

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/subserver/logging.rb

Direct Known Subclasses

WithoutTimestamp

Constant Summary collapse

SPACE =
" "

Instance Method Summary collapse

Instance Method Details

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

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



13
14
15
# File 'lib/subserver/logging.rb', line 13

def call(severity, time, program_name, message)
  "#{time.utc.iso8601(3)} #{::Process.pid} TID-#{Subserver::Logging.tid}#{context} #{severity}: #{message}\n"
end

#contextObject



17
18
19
20
# File 'lib/subserver/logging.rb', line 17

def context
  c = Thread.current[:subserver_context]
  " #{c.join(SPACE)}" if c && c.any?
end