class Archfiend::Logging::BaseFormatter

Constants

SEVERITY_STACK_ENTRIES_COUNT
STACK_ENTRIES_TO_SKIP

Private Instance Methods

description_and_backtrace(severity, msg) click to toggle source
# File lib/archfiend/logging/base_formatter.rb, line 16
def description_and_backtrace(severity, msg)
  description = nil
  backtrace = nil

  if msg.is_a?(Hash)
    description = msg[:message]
    backtrace = msg[:backtrace]&.slice(0, SEVERITY_STACK_ENTRIES_COUNT[severity])
  else
    description = msg
  end
  backtrace ||= caller.slice(STACK_ENTRIES_TO_SKIP - 1, SEVERITY_STACK_ENTRIES_COUNT[severity])
  [description, backtrace]
end
tid() click to toggle source
# File lib/archfiend/logging/base_formatter.rb, line 30
def tid
  Thread.current[:tid] ||= (Thread.current.object_id ^ ::Process.pid).to_s(36)
end