lib/request_log_analyzer/controller.rb in request-log-analyzer-1.7.0 vs lib/request_log_analyzer/controller.rb in request-log-analyzer-1.8.0
- old
+ new
@@ -19,11 +19,11 @@
# Builds a RequestLogAnalyzer::Controller given parsed command line arguments
# <tt>arguments<tt> A CommandLine::Arguments hash containing parsed commandline parameters.
def self.build_from_arguments(arguments)
- require 'lib/mixins/gets_memory_protection' if arguments[:gets_memory_protection]
+ require File.dirname(__FILE__) + '/../mixins/gets_memory_protection' if arguments[:gets_memory_protection]
options = {}
# Copy fields
options[:database] = arguments[:database]
@@ -43,10 +43,11 @@
options[:aggregator] = arguments[:aggregator]
options[:report_width] = arguments[:report_width]
options[:report_sort] = arguments[:report_sort]
options[:report_amount] = arguments[:report_amount]
options[:mailhost] = arguments[:mailhost]
+ options[:mailsubject] = arguments[:mailsubject]
options[:silent] = arguments[:silent]
# Apache format workaround
if arguments[:rails_format]
options[:format] = {:rails => arguments[:rails_format]}
@@ -105,10 +106,11 @@
# * <tt>:debug</tt> Enables echo aggregator which will echo each request analyzed.
# * <tt>:file</tt> Filestring, File or StringIO.
# * <tt>:format</tt> :rails, {:apache => 'FORMATSTRING'}, :merb, :amazon_s3, :mysql or RequestLogAnalyzer::FileFormat class. (Defaults to :rails).
# * <tt>:mail</tt> Email the results to this email address.
# * <tt>:mailhost</tt> Email the results to this mail server.
+ # * <tt>:mailsubject</tt> Email subject.
# * <tt>:no_progress</tt> Do not display the progress bar (increases parsing speed).
# * <tt>:output</tt> 'FixedWidth', 'HTML' or RequestLogAnalyzer::Output class. Defaults to 'FixedWidth'.
# * <tt>:reject</tt> Reject specific {:field => :value} combination (expects a single hash).
# * <tt>:report_width</tt> Width of reports in characters for FixedWidth reports. (Defaults to 80)
# * <tt>:reset_database</tt> Reset the database before starting.
@@ -161,10 +163,10 @@
if options[:file]
output_object = %w[File StringIO].include?(options[:file].class.name) ? options[:file] : File.new(options[:file], "w+")
output_args = {:width => 80, :color => false, :characters => :ascii, :sort => output_sort, :amount => output_amount }
elsif options[:mail]
- output_object = RequestLogAnalyzer::Mailer.new(options[:mail], options[:mailhost])
+ output_object = RequestLogAnalyzer::Mailer.new(options[:mail], options[:mailhost], :subject => options[:mailsubject])
output_args = {:width => 80, :color => false, :characters => :ascii, :sort => output_sort, :amount => output_amount }
else
output_object = STDOUT
output_args = {:width => options[:report_width].to_i, :color => !options[:boring],
:characters => (options[:boring] ? :ascii : :utf), :sort => output_sort, :amount => output_amount }