logtrend 0.4.20101204161637 → 0.5.20101204163902

Sign up to get free protection for your applications and to get access to all the features.
data/lib/logtrend.rb CHANGED
@@ -37,10 +37,10 @@ class LogTrend
37
37
  def build_graph(graphs_dir, rrd_dir, graph)
38
38
  RRD.graph File.join(graphs_dir,"#{graph.name}.png"), :title => graph.name, :width => 800, :height => 250, :color => ["FONT#000000", "BACK#FFFFFF"] do
39
39
  graph.points.each do |point|
40
- if point[:style] == :line
41
- line File.join(rrd_dir,"#{point[:name]}.rrd"), "#{point[:name]}_count" => :average, :color => point[:color], :label => point[:name].to_s
42
- elsif point[:style] == :area
43
- area File.join(rrd_dir,"#{point[:name]}.rrd"), "#{point[:name]}_count" => :average, :color => point[:color], :label => point[:name].to_s
40
+ if point.style == :line
41
+ line File.join(rrd_dir,"#{point.name}.rrd"), "#{point.name}_count" => :average, :color => point.color, :label => point.name.to_s
42
+ elsif point.style == :area
43
+ area File.join(rrd_dir,"#{point.name}.rrd"), "#{point.name}_count" => :average, :color => point.color, :label => point.name.to_s
44
44
  end
45
45
  end
46
46
  end
@@ -102,6 +102,8 @@ class Graph
102
102
  end
103
103
 
104
104
  def add_point(style,name,color)
105
- @points << {:style => style, :name => name, :color => color}
105
+ @points << GraphPoint.new(style, name, color)
106
106
  end
107
- end
107
+ end
108
+
109
+ GraphPoint = Struct.new(:style, :name, :color)
data/samples/example.rb CHANGED
@@ -15,8 +15,9 @@ LogTrend.start('test.log', "/tmp/rrd", "/tmp/graphs") do |l|
15
15
  l.add_trend(:kod) {|line| line.match /kilnhg.com/}
16
16
 
17
17
  l.add_graph(:requests_per_minute) do |g|
18
- g.add_point :area, :fbod, "#0066cc"
19
- g.add_point :area, :kod, "#993333"
18
+ g.add_point :area, :total, "#333333"
19
+ g.add_point :line, :fbod, "#0066cc"
20
+ g.add_point :line, :kod, "#993333"
20
21
  end
21
22
 
22
23
  end
data/samples/test.log CHANGED
@@ -27,3 +27,7 @@ test
27
27
  test
28
28
  test
29
29
  test
30
+ test
31
+ test
32
+ test
33
+ test
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logtrend
3
3
  version: !ruby/object:Gem::Version
4
- hash: 40202408323269
4
+ hash: 40202408327799
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 20101204161637
10
- version: 0.4.20101204161637
8
+ - 5
9
+ - 20101204163902
10
+ version: 0.5.20101204163902
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Gorsuch