Sha256: 59b6839a8e5f43bfac233fed67545142e0fa5110492a10c484d2ab7640a6cf07
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
module Logifyer::Common::JSON def build_event(message, severity, time) data = message if data.is_a?(String) && data.start_with?('{'.freeze) data = (JSON.parse(message) rescue nil) || message end event = case data when Hash data else {"message".freeze => msg2str(data)} end event[@config[:level].freeze] ||= severity if @config[:level] event[@config[:timestamp].freeze] = current_time(time).iso8601(3) if @config[:timestamp] "#{@ext.merge(event).to_json}\n" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logifyer-0.1.0 | lib/logifyer/common_json.rb |