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



118
119
120
# File 'lib/sidekiq/logger.rb', line 118

def ctx
  Sidekiq::Context.current
end

#format_contextObject



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/sidekiq/logger.rb', line 122

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



114
115
116
# File 'lib/sidekiq/logger.rb', line 114

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