Sha256: c45b56adf7e160c3b9b9ac96c0509051fd6072487a17ea6e46698ec3b1cc54c8
Contents?: true
Size: 731 Bytes
Versions: 15
Compression:
Stored size: 731 Bytes
Contents
module MotherBrain module Logging class BasicFormat < Logger::Formatter def call(severity, datetime, progname, msg) message = msg.to_s if match = message.match(/NODE\[.+?\]/) format_matched_lines match, message else "[#{datetime.utc.iso8601}] PID[#{Process.pid}] TID[#{Thread.current.object_id.to_s(36)}] #{severity}: #{message}\n" end end private def format_matched_lines(match, message) lines = message.lines.to_a lines.map! do |line| if line.start_with? match.to_s line else "#{match} #{line}" end end lines.join("\n") << "\n" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems