Class: Dexter::JsonLogParser
- Defined in:
- lib/dexter/json_log_parser.rb
Constant Summary collapse
- FIRST_LINE_REGEX =
/\A.+/
Constants inherited from LogParser
Constants included from Logging
Instance Method Summary collapse
Methods inherited from LogParser
Methods included from Logging
Constructor Details
This class inherits a constructor from Dexter::LogParser
Instance Method Details
#perform ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dexter/json_log_parser.rb', line 5 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.}" end |