Sha256: 3f87cee932ea26ba3ba4be43c9fabd908ff1b58fe9f205ec8d13151d4eab22f6
Contents?: true
Size: 514 Bytes
Versions: 1
Compression:
Stored size: 514 Bytes
Contents
require 'time' class StrftimeLogger class LtsvFormatter def initialize(opts={}) end def call(severity, message = nil, &block) if message.nil? if block_given? message = yield else message = "" end end "#{format_message(message)}\n" end private def format_message(message) unless message.is_a?(Hash) message = { message: message } end message.map {|k, v| "#{k}:#{v}" }.join("\t") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strftime_logger-0.0.1 | lib/strftime_logger/ltsv_formatter.rb |