bin/request-log-analyzer in wvanbergen-request-log-analyzer-1.2.9 vs bin/request-log-analyzer in wvanbergen-request-log-analyzer-1.3.0
- old
+ new
@@ -1,52 +1,62 @@
#!/usr/bin/ruby
-require File.dirname(__FILE__) + '/../lib/request_log_analyzer'
-require File.dirname(__FILE__) + '/../lib/cli/command_line_arguments'
-require File.dirname(__FILE__) + '/../lib/cli/progressbar'
-require File.dirname(__FILE__) + '/../lib/cli/tools'
+$:.unshift(File.dirname(__FILE__) + '/../lib')
+require 'request_log_analyzer'
+require 'cli/command_line_arguments'
+require 'lib/cli/progressbar'
+require 'lib/cli/tools'
# Parse the arguments given via commandline
begin
arguments = CommandLine::Arguments.parse do |command_line|
command_line.command(:install) do |install|
install.parameters = 1
end
-
+
+ command_line.command(:console) do |cons|
+ cons.option(:database, :alias => :d, :required => true)
+ cons.option(:format, :alias => :f, :default => 'rails')
+ cons.option(:apache_format)
+ end
+
command_line.command(:strip) do |strip|
strip.minimum_parameters = 1
- strip.option(:format, :alias => :f, :default => 'rails')
+ strip.option(:format, :alias => :f, :default => 'rails')
strip.option(:output, :alias => :o)
strip.switch(:discard_teaser_lines, :t)
strip.switch(:keep_junk_lines, :j)
end
-
+
command_line.option(:format, :alias => :f, :default => 'rails')
command_line.option(:apache_format)
-
+
command_line.option(:file, :alias => :e)
+ command_line.option(:mail, :alias => :m)
command_line.option(:parse_strategy, :default => 'assume-correct')
command_line.option(:dump)
-
+
command_line.option(:aggregator, :alias => :a, :multiple => true)
- command_line.option(:database, :alias => :d)
+ command_line.option(:database, :alias => :d)
+ command_line.switch(:reset_database)
+
# filtering options
command_line.option(:select, :multiple => true, :parameters => 2)
command_line.option(:reject, :multiple => true, :parameters => 2)
command_line.option(:after)
- command_line.option(:before)
-
+ command_line.option(:before)
+
command_line.switch(:boring, :b)
- command_line.option(:output, :alias => :o, :default => 'FixedWidth')
+ command_line.option(:output, :alias => :o, :default => 'FixedWidth')
command_line.option(:report_width, :default => terminal_width - 1)
-
+
command_line.switch(:debug)
-
- command_line.minimum_parameters = 1
+
+ command_line.minimum_parameters = 1
end
-
+
rescue CommandLine::Error => e
puts "Request-log-analyzer, by Willem van Bergen and Bart ten Brinke - version #{RequestLogAnalyzer::VERSION}"
puts "Website: http://railsdoctors.com"
puts
puts "ARGUMENT ERROR: " + e.message if e.message
@@ -63,10 +73,11 @@
puts "Output options:"
puts " --boring, -b Output reports without ASCII colors."
puts " --database <filename>, -d: Creates an SQLite3 database of all the parsed request information."
puts " --debug Print debug information while parsing."
puts " --file <filename> Output to file."
+ puts " --mail <emailaddress> Send report to an email address."
puts " --output <format> Output format. Supports 'HTML' and 'FixedWidth' (default)"
puts " --dump <filename> Dump the YAML formatted results in the given file"
puts
puts "Examples:"
puts " request-log-analyzer development.log"
@@ -81,14 +92,17 @@
end
case arguments.command
when :install
install_rake_tasks(arguments.parameters[0])
+when :console
+ require 'cli/database_console'
+ DatabaseConsole.new(arguments).run!
when :strip
- require File.dirname(__FILE__) + '/../lib/request_log_analyzer/log_processor'
+ require File.dirname(__FILE__) + '/../lib/request_log_analyzer/log_processor'
RequestLogAnalyzer::LogProcessor.build(:strip, arguments).run!
else
- puts "Request-log-analyzer, by Willem van Bergen and Bart ten Brinke - version #{RequestLogAnalyzer::VERSION}"
+ puts "Request-log-analyzer, by Willem van Bergen and Bart ten Brinke - version #{RequestLogAnalyzer::VERSION}"
puts "Website: http://railsdoctors.com"
puts
# Run the request_log_analyzer!
RequestLogAnalyzer::Controller.build(arguments).run!