Sha256: 74c878c609d91eb9116a352144653ca5656c5b2bb7afdeb0bae4534cf715b5f8
Contents?: true
Size: 620 Bytes
Versions: 2
Compression:
Stored size: 620 Bytes
Contents
require "json" module Dexter class JsonLogParser < LogParser FIRST_LINE_REGEX = /\A.+/ def perform @logfile.each_line do |line| row = JSON.parse(line.chomp) if (m = REGEX.match(row["message"])) # replace first line with match # needed for multiline queries active_line = row["message"].sub(FIRST_LINE_REGEX, m[3]) add_parameters(active_line, row["detail"]) if row["detail"] process_entry(active_line, m[1].to_f) end end rescue JSON::ParserError => e raise Dexter::Abort, "ERROR: #{e.message}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pgdexter-0.4.2 | lib/dexter/json_log_parser.rb |
pgdexter-0.4.1 | lib/dexter/json_log_parser.rb |