Class: Sidekiq::Logger::Formatters::Base

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

Direct Known Subclasses

JSON, Pretty

Instance Method Summary collapse

Instance Method Details

#ctxObject



84
85
86
# File 'lib/sidekiq/logger.rb', line 84

def ctx
  Sidekiq::Context.current
end

#format_contextObject



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/sidekiq/logger.rb', line 88

def format_context
  if ctx.any?
    " " + ctx.compact.map { |k, v|
      case v
      when Array
        "#{k}=#{v.join(",")}"
      else
        "#{k}=#{v}"
      end
    }.join(" ")
  end
end

#tidObject



80
81
82
# File 'lib/sidekiq/logger.rb', line 80

def tid
  Thread.current["sidekiq_tid"] ||= (Thread.current.object_id ^ ::Process.pid).to_s(36)
end