This repository has been archived by the owner on May 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created RailsAnalyzer class to wrap top-level logic.
Output to console has been reduced to top-level status info
- Loading branch information
Showing
3 changed files
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
require 'uri' | ||
require 'rubygems' | ||
require 'activesupport' | ||
require 'rails_analyzer' | ||
require 'time_stats' | ||
require 'hit_stats' | ||
|
||
puts | ||
puts "Rails log analyzer" | ||
puts "Analyzes a number of rails log files and compiles an overview list." | ||
puts | ||
logs=[] | ||
if $*.size==0 | ||
logs=["log/production.log"] | ||
else | ||
logs=$* | ||
end | ||
logs.each {|l| puts "Using log: #{l}"} | ||
puts | ||
|
||
TimeStats.generate(logs) | ||
puts 'Wrote time-based logs' | ||
|
||
HitStats.generate(logs) | ||
ra = RailsAnalyzer.new(ARGV) | ||
ra.generate_reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,30 @@ | ||
require 'rubygems' | ||
require 'activesupport' | ||
require 'uri' | ||
require 'float_ext' | ||
require 'array_ext' | ||
require 'pretty_log' | ||
require 'param_log' | ||
require 'time_stats' | ||
require 'hit_stats' | ||
|
||
class RailsAnalyzer | ||
attr_accessor :logs | ||
|
||
def initialize(logs=[]) | ||
@logs = logs | ||
@logs = %w[log/production.log] if logs.size==0 | ||
end | ||
|
||
def generate_reports | ||
puts "RailsAnalyzer" | ||
puts "Analyzes the following Rails log files:" | ||
puts logs.map{|l| ' %s' % l}.join("\n") | ||
|
||
puts 'Generating time-based reports' | ||
TimeStats.generate(logs) | ||
|
||
puts 'Generating hit-based reports' | ||
HitStats.generate(logs) | ||
end | ||
end |