Class: Sidekiq::Logging::Pretty

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/sidekiq/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.



11
12
13
# File 'lib/sidekiq/logging.rb', line 11

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

#contextObject



15
16
17
18
# File 'lib/sidekiq/logging.rb', line 15

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