lib/request_log_analyzer/controller.rb in request-log-analyzer-1.3.1 vs lib/request_log_analyzer/controller.rb in request-log-analyzer-1.3.2

- old
+ new

@@ -33,14 +33,15 @@ options = { } # Database command line options options[:database] = arguments[:database] if arguments[:database] options[:reset_database] = arguments[:reset_database] - options[:debug] = arguments[:debug] options[:dump] = arguments[:dump] - + options[:parse_strategy] = arguments[:parse_strategy] + options[:no_progress] = arguments[:no_progress] + output_class = RequestLogAnalyzer::Output::const_get(arguments[:output]) if arguments[:file] output_file = File.new(arguments[:file], "w+") options[:output] = output_class.new(output_file, :width => 80, :color => false, :characters => :ascii) elsif arguments[:mail] @@ -73,14 +74,12 @@ options.store(:source_files, arguments.parameters) end controller = Controller.new(RequestLogAnalyzer::Source::LogParser.new(file_format, options), options) #controller = Controller.new(RequestLogAnalyzer::Source::DatabaseLoader.new(file_format, options), options) - - options[:parse_strategy] = arguments[:parse_strategy] - # register filters + # register filters if arguments[:after] || arguments[:before] filter_options = {} filter_options[:after] = DateTime.parse(arguments[:after]) filter_options[:before] = DateTime.parse(arguments[:before]) if arguments[:before] controller.add_filter(:timespan, filter_options) @@ -131,11 +130,12 @@ # Pass all warnings to every aggregator so they can do something useful with them. @source.warning = lambda { |type, message, lineno| @aggregators.each { |agg| agg.warning(type, message, lineno) } } if @source # Handle progress messagess - @source.progress = lambda { |message, value| handle_progress(message, value) } if @source + @source.progress = lambda { |message, value| handle_progress(message, value) } if @source && !options[:no_progress] + # Handle source change messages @source.source_changes = lambda { |change, filename| handle_source_change(change, filename) } if @source end # Progress function. # Expects :started with file, :progress with current line and :finished or :interrupted when done.