lib/log_stats.rb in log_stats-0.4.2 vs lib/log_stats.rb in log_stats-0.4.3

- old
+ new

@@ -1,6 +1,7 @@ require "json" +require "log_stats/logger" require "log_stats/version" require "log_stats/line_parser" require "log_stats/logger" require "log_stats/stats" require "log_stats/requests/stats" @@ -12,17 +13,18 @@ data = get_data(log_data, config) if config[:output_format] == "text" && request_config = config[:events][:requests] Requests::TextOutput.print(data[:requests], request_config) end if config[:output_format] == "json" - puts JSON.generate(data) + puts JSON.pretty_generate(data) end data end def self.get_data(log_data, config) - Logger.info(config, "\nParsing log lines...") - events = LineParser.parse(log_data, config) + events = Logger.elapsed(config, "\nParsing #{log_data.length} log lines") do + LineParser.parse(log_data, config) + end result = {} if requests = events[:requests] result[:requests] = get_requests_data(requests, config) end other_event_names = events.keys.reject { |k| k == :requests }