module LogFormatter::Common

Public Instance Methods

current_time(time) click to toggle source
# File lib/log_formatter/common.rb, line 14
def current_time(time)
  return time if time
  Time.respond_to?(:current) ? Time.current : Time.now
end
msg2str(msg) click to toggle source
# File lib/log_formatter/common.rb, line 2
def msg2str(msg)
  case msg
  when ::String
    msg.gsub("\n", "\t")
  when ::Exception
    "#{ msg.message } (#{ msg.class })\t" <<
      (msg.backtrace || []).join("\t")
  else
    msg.inspect
  end
end