formatted-metrics 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
+ require 'logger'
2
+
1
3
  module Metrics
2
4
  class Configuration
3
5
  # The stream source to write to. Defaults to STDOUT.
4
- attr_accessor :stream
6
+ attr_accessor :logger
5
7
 
6
8
  # The base source for all metrics.
7
9
  attr_accessor :source
@@ -10,8 +12,8 @@ module Metrics
10
12
  # Defaults to Metrics::Formatter.
11
13
  attr_accessor :formatter
12
14
 
13
- def stream
14
- @stream ||= STDOUT
15
+ def logger
16
+ @logger ||= Logger.new(STDOUT)
15
17
  end
16
18
 
17
19
  def source
@@ -27,7 +27,7 @@ module Metrics
27
27
  end
28
28
 
29
29
  def log
30
- configuration.stream.puts configuration.formatter.new(event).to_s
30
+ configuration.logger.info configuration.formatter.new(event).to_s
31
31
  end
32
32
 
33
33
  end
@@ -1,3 +1,3 @@
1
1
  module FormattedMetrics
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -19,7 +19,7 @@ describe Metrics::Handler do
19
19
  end
20
20
 
21
21
  it 'should handle the event' do
22
- Metrics.configuration.stream.should_receive(:puts).with(formatter.to_s)
22
+ Metrics.configuration.logger.should_receive(:info).with(formatter.to_s)
23
23
  handler.handle
24
24
  end
25
25
  end
@@ -30,7 +30,7 @@ describe Metrics::Handler do
30
30
  end
31
31
 
32
32
  it 'should not handle the event' do
33
- Metrics.configuration.stream.should_receive(:puts).never
33
+ Metrics.configuration.logger.should_receive(:info).never
34
34
  handler.handle
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatted-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: 3996824533654681109
121
+ hash: -222700962524494788
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: 3996824533654681109
130
+ hash: -222700962524494788
131
131
  requirements: []
132
132
  rubyforge_project:
133
133
  rubygems_version: 1.8.23