module ThreadedLogging

Constants

FORMAT
VERSION

Public Class Methods

thread_fingerprint() click to toggle source
# File lib/threaded_logging.rb, line 8
def self.thread_fingerprint
  Digest::MD5.hexdigest([Thread.current.object_id, $PID].join)[0...8]
end

Public Instance Methods

call(severity, time, _progname, msg) click to toggle source
# File lib/threaded_logging.rb, line 14
def call(severity, time, _progname, msg)
  message = +""

  msg2str(msg).to_s.lines.each do |line|
    message << format(
      FORMAT, severity[0], format_datetime(time), ThreadedLogging.thread_fingerprint, line
    )
  end

  message << "\n"
  message
end

Private Instance Methods

format_datetime(time) click to toggle source
# File lib/threaded_logging.rb, line 29
def format_datetime(time)
  time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N")
end