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



109
110
111
# File 'lib/sidekiq/logger.rb', line 109

def ctx
  Sidekiq::Context.current
end

#format_contextObject



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/sidekiq/logger.rb', line 113

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



105
106
107
# File 'lib/sidekiq/logger.rb', line 105

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