blabbermouth 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blabbermouth.rb +5 -5
- data/lib/blabbermouth/blabber.rb +45 -45
- data/lib/blabbermouth/bystanders.rb +7 -0
- data/lib/blabbermouth/{gawkers → bystanders}/base.rb +1 -1
- data/lib/blabbermouth/bystanders/new_relic.rb +35 -0
- data/lib/blabbermouth/{gawkers → bystanders}/stdout.rb +1 -1
- data/lib/blabbermouth/configuration.rb +1 -1
- data/lib/blabbermouth/version.rb +1 -1
- data/spec/blabbermouth/blabber_spec.rb +57 -57
- data/spec/blabbermouth/{gawkers → bystanders}/base_spec.rb +1 -1
- data/spec/blabbermouth/bystanders/new_relic_spec.rb +5 -0
- data/spec/blabbermouth/{gawkers → bystanders}/stdout_spec.rb +1 -1
- data/spec/blabbermouth_spec.rb +10 -10
- data/spec/spec_helper.rb +1 -1
- data/spec/support/{gawker.rb → bystander.rb} +1 -1
- metadata +17 -14
- data/lib/blabbermouth/gawkers.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 010d190597b04b7a4ea7709fddd137c9d9975b81
|
4
|
+
data.tar.gz: 9263f8c9c390a5447092f5b4dba3735f1c2f77e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b08e982695a8e518ea8b7a3ed04d806743723ef9c815a944dbd968289114deddaa0a38143c882c1228caf93f882282d3f1bece563c39f1c7170a27a7c1ef38f8
|
7
|
+
data.tar.gz: b6573f304388f7660560abffa576febf14d6190b94119ee57063da6c27c5be4ae63c28aade92c96c08d7c64b84ad3920f82b0bea63c0f86aa9eadc6dcbf410ce
|
data/lib/blabbermouth.rb
CHANGED
@@ -3,7 +3,7 @@ require 'active_support/core_ext/array/extract_options'
|
|
3
3
|
require 'active_support/core_ext/string'
|
4
4
|
require 'blabbermouth/version'
|
5
5
|
require 'blabbermouth/configuration'
|
6
|
-
require 'blabbermouth/
|
6
|
+
require 'blabbermouth/bystanders'
|
7
7
|
require 'blabbermouth/blabber'
|
8
8
|
|
9
9
|
module Blabbermouth
|
@@ -14,12 +14,12 @@ module Blabbermouth
|
|
14
14
|
@@configuration.configure &block
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.blabber(*
|
18
|
-
Blabbermouth::Blabber.new *
|
17
|
+
def self.blabber(*bystanders)
|
18
|
+
Blabbermouth::Blabber.new *bystanders
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.new(*
|
22
|
-
blabber *
|
21
|
+
def self.new(*bystanders)
|
22
|
+
blabber *bystanders
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.error(key, e, *args)
|
data/lib/blabbermouth/blabber.rb
CHANGED
@@ -1,84 +1,84 @@
|
|
1
1
|
module Blabbermouth
|
2
2
|
class Blabber
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :bystanders, :options
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def parse_args(*args)
|
7
7
|
opts = args.extract_options!
|
8
|
-
args = Blabbermouth.configuration.
|
9
|
-
|
10
|
-
[
|
8
|
+
args = Blabbermouth.configuration.bystanders if args.empty?
|
9
|
+
bystanders = args + [opts.slice!(:data)]
|
10
|
+
[bystanders, opts]
|
11
11
|
end
|
12
12
|
|
13
13
|
def error(key, e, *args)
|
14
|
-
|
15
|
-
new(*
|
14
|
+
bystanders, opts = parse_args(*args)
|
15
|
+
new(*bystanders).error(key, e, opts)
|
16
16
|
end
|
17
17
|
|
18
18
|
def info(key, msg=nil, *args)
|
19
|
-
|
20
|
-
new(*
|
19
|
+
bystanders, opts = parse_args(*args)
|
20
|
+
new(*bystanders).info(key, msg, opts)
|
21
21
|
end
|
22
22
|
|
23
23
|
def increment(key, by=1, *args)
|
24
|
-
|
25
|
-
new(*
|
24
|
+
bystanders, opts = parse_args(*args)
|
25
|
+
new(*bystanders).increment(key, by, opts)
|
26
26
|
end
|
27
27
|
|
28
28
|
def count(key, total, *args)
|
29
|
-
|
30
|
-
new(*
|
29
|
+
bystanders, opts = parse_args(*args)
|
30
|
+
new(*bystanders).count(key, total, opts)
|
31
31
|
end
|
32
32
|
|
33
33
|
def time(key, duration=nil, *args, &block)
|
34
|
-
|
35
|
-
new(*
|
34
|
+
bystanders, opts = parse_args(*args)
|
35
|
+
new(*bystanders).time(key, duration, opts, &block)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
@
|
41
|
-
unless
|
42
|
-
@
|
39
|
+
def add_bystander!(bystander)
|
40
|
+
@bystanders ||= []
|
41
|
+
unless bystander_exists?(bystander)
|
42
|
+
@bystanders << "Blabbermouth::Bystanders::#{bystander.to_s.camelize}".constantize.new
|
43
43
|
end
|
44
|
-
@
|
44
|
+
@bystanders
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
48
|
-
|
47
|
+
def add_bystander(bystander)
|
48
|
+
add_bystander! bystander
|
49
49
|
rescue => e
|
50
50
|
false
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
54
|
-
return if @
|
55
|
-
@
|
53
|
+
def remove_bystander!(bystander)
|
54
|
+
return if @bystanders.nil?
|
55
|
+
@bystanders.slice!(bystander_index(bystander), 1)
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
58
|
+
def remove_bystander(bystander)
|
59
|
+
remove_bystander! bystander
|
60
60
|
rescue => e
|
61
61
|
false
|
62
62
|
end
|
63
63
|
|
64
64
|
def error(key, e, *args)
|
65
65
|
opts = args.extract_options!
|
66
|
-
|
66
|
+
bystanders.map { |bystander| bystander.error key, e, *args.concat([bystander_options(bystander, opts)]) }
|
67
67
|
end
|
68
68
|
|
69
69
|
def info(key, msg=nil, *args)
|
70
70
|
opts = args.extract_options!
|
71
|
-
|
71
|
+
bystanders.map { |bystander| bystander.info key, msg, *args.concat([bystander_options(bystander, opts)]) }
|
72
72
|
end
|
73
73
|
|
74
74
|
def increment(key, by=1, *args)
|
75
75
|
opts = args.extract_options!
|
76
|
-
|
76
|
+
bystanders.map { |bystander| bystander.increment key, by, *args.concat([bystander_options(bystander, opts)]) }
|
77
77
|
end
|
78
78
|
|
79
79
|
def count(key, total, *args)
|
80
80
|
opts = args.extract_options!
|
81
|
-
|
81
|
+
bystanders.map { |bystander| bystander.count key, total, *args.concat([bystander_options(bystander, opts)]) }
|
82
82
|
end
|
83
83
|
|
84
84
|
def time(key, duration=nil, *args, &block)
|
@@ -91,38 +91,38 @@ module Blabbermouth
|
|
91
91
|
duration = (::Time.now - start_time).to_f
|
92
92
|
end
|
93
93
|
|
94
|
-
|
94
|
+
bystanders.map { |bystander| bystander.time key, duration, *args.concat([bystander_options(bystander, opts)]) }
|
95
95
|
end
|
96
96
|
|
97
97
|
def method_missing(meth, *args, &block)
|
98
|
-
|
99
|
-
next unless
|
100
|
-
|
98
|
+
bystanders.map do |bystander|
|
99
|
+
next unless bystander.respond_to?(meth)
|
100
|
+
bystander.send(meth, *args, &block)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
104
|
def respond_to_missing?(meth, include_private=false)
|
105
|
-
|
105
|
+
bystanders.any? { |bystander| bystander.respond_to?(meth, include_private) }
|
106
106
|
end
|
107
107
|
|
108
108
|
protected
|
109
109
|
|
110
|
-
def initialize(*
|
111
|
-
@options =
|
112
|
-
|
113
|
-
|
110
|
+
def initialize(*bystdrs)
|
111
|
+
@options = bystdrs.extract_options!
|
112
|
+
bystdrs.concat(options.keys).uniq
|
113
|
+
bystdrs.each { |bystander| add_bystander! bystander }
|
114
114
|
end
|
115
115
|
|
116
|
-
def
|
117
|
-
(@options[
|
116
|
+
def bystander_options(bystander, opts={})
|
117
|
+
(@options[bystander.class.name.demodulize.underscore.to_sym] || {}).merge(opts)
|
118
118
|
end
|
119
119
|
|
120
|
-
def
|
121
|
-
@
|
120
|
+
def bystander_index(bystander)
|
121
|
+
@bystanders.index { |bystdr| bystdr.class.name.demodulize.underscore == bystander.to_s }
|
122
122
|
end
|
123
123
|
|
124
|
-
def
|
125
|
-
!
|
124
|
+
def bystander_exists?(bystander)
|
125
|
+
!bystander_index(bystander).nil?
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Blabbermouth
|
2
|
+
module Bystanders
|
3
|
+
class NewRelic < Base
|
4
|
+
def error(key, e, *args)
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
def info(key, msg=nil, *args)
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def increment(key, by=1, *args)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def count(key, total, *args)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def time(key, duration=nil, *args)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def new_relic?
|
27
|
+
defined?(::NewRelic)
|
28
|
+
end
|
29
|
+
|
30
|
+
def new_relic!
|
31
|
+
raise "You must require and configure the newrelic_rpm gem to use it as a bystander" unless new_relic?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/blabbermouth/version.rb
CHANGED
@@ -1,124 +1,124 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Blabbermouth::Blabber do
|
4
|
-
describe '#
|
5
|
-
context 'when the
|
6
|
-
it 'adds a
|
7
|
-
subject.
|
8
|
-
expect(subject.
|
9
|
-
expect(subject.
|
4
|
+
describe '#add_bystander!' do
|
5
|
+
context 'when the bystander does not exist' do
|
6
|
+
it 'adds a bystander to the list of bystanders' do
|
7
|
+
subject.add_bystander!(:rails)
|
8
|
+
expect(subject.bystanders.count).to eql(1)
|
9
|
+
expect(subject.bystanders.first).to be_an_instance_of(Blabbermouth::Bystanders::Rails)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe '#
|
15
|
-
context 'when the
|
16
|
-
it 'removes a
|
17
|
-
subject.
|
18
|
-
expect(subject.
|
19
|
-
subject.
|
20
|
-
expect(subject.
|
14
|
+
describe '#remove_bystander!' do
|
15
|
+
context 'when the bystander exists' do
|
16
|
+
it 'removes a bystander from the list of bystanders' do
|
17
|
+
subject.add_bystander!(:rails)
|
18
|
+
expect(subject.bystanders.count).to eql(1)
|
19
|
+
subject.remove_bystander!(:rails)
|
20
|
+
expect(subject.bystanders.count).to eql(0)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#error' do
|
26
|
-
it 'blabs to any added
|
27
|
-
subject.
|
28
|
-
subject.
|
26
|
+
it 'blabs to any added bystanders' do
|
27
|
+
subject.add_bystander!(:test)
|
28
|
+
subject.add_bystander!(:rails)
|
29
29
|
subject.error('key', StandardError.new)
|
30
|
-
expect(Blabbermouth::
|
31
|
-
expect(Rails.logger.errors).to include(Blabbermouth::
|
30
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:error, 'key', StandardError.new.message)).to be_true
|
31
|
+
expect(Rails.logger.errors).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :error, 'key', StandardError.new))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#info' do
|
36
|
-
it 'blabs to any added
|
37
|
-
subject.
|
38
|
-
subject.
|
36
|
+
it 'blabs to any added bystanders' do
|
37
|
+
subject.add_bystander!(:test)
|
38
|
+
subject.add_bystander!(:rails)
|
39
39
|
subject.info('key', 'test')
|
40
|
-
expect(Blabbermouth::
|
41
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
40
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:info, 'key', 'test')).to be_true
|
41
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :info, 'key', 'test'))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#increment' do
|
46
|
-
it 'blabs to any added
|
47
|
-
subject.
|
48
|
-
subject.
|
46
|
+
it 'blabs to any added bystanders' do
|
47
|
+
subject.add_bystander!(:test)
|
48
|
+
subject.add_bystander!(:rails)
|
49
49
|
subject.increment('key', 1)
|
50
|
-
expect(Blabbermouth::
|
51
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
50
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:increment, 'key', 1)).to be_true
|
51
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :increment, 'key', 1))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe '#count' do
|
56
|
-
it 'blabs to any added
|
57
|
-
subject.
|
58
|
-
subject.
|
56
|
+
it 'blabs to any added bystanders' do
|
57
|
+
subject.add_bystander!(:test)
|
58
|
+
subject.add_bystander!(:rails)
|
59
59
|
subject.count('key', 1)
|
60
|
-
expect(Blabbermouth::
|
61
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
60
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:count, 'key', 1)).to be_true
|
61
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :count, 'key', 1))
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe '#time' do
|
66
|
-
it 'blabs to any added
|
67
|
-
subject.
|
68
|
-
subject.
|
66
|
+
it 'blabs to any added bystanders' do
|
67
|
+
subject.add_bystander!(:test)
|
68
|
+
subject.add_bystander!(:rails)
|
69
69
|
subject.time('key', 1)
|
70
|
-
expect(Blabbermouth::
|
71
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
70
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:time, 'key', 1)).to be_true
|
71
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :time, 'key', 1))
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe '#method_missing' do
|
76
|
-
context 'when added
|
77
|
-
it 'passes method calls through to added
|
78
|
-
subject.
|
76
|
+
context 'when added bystanders respond to the requested method' do
|
77
|
+
it 'passes method calls through to added bystanders' do
|
78
|
+
subject.add_bystander!(:test)
|
79
79
|
subject.test('key', 'test')
|
80
|
-
expect(Blabbermouth::
|
80
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:test, 'key', 'test')).to be_true
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe '.error' do
|
86
|
-
it 'blabs to any provided
|
86
|
+
it 'blabs to any provided bystanders' do
|
87
87
|
Blabbermouth::Blabber.error('key', StandardError.new, :test, :rails)
|
88
|
-
expect(Blabbermouth::
|
89
|
-
expect(Rails.logger.errors).to include(Blabbermouth::
|
88
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:error, 'key', StandardError.new.message)).to be_true
|
89
|
+
expect(Rails.logger.errors).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :error, 'key', StandardError.new))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe '.info' do
|
94
|
-
it 'blabs to any provided
|
94
|
+
it 'blabs to any provided bystanders' do
|
95
95
|
Blabbermouth::Blabber.info('key', 'test', :test, :rails)
|
96
|
-
expect(Blabbermouth::
|
97
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
96
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:info, 'key', 'test')).to be_true
|
97
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :info, 'key', 'test'))
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
describe '.increment' do
|
102
|
-
it 'blabs to any provided
|
102
|
+
it 'blabs to any provided bystanders' do
|
103
103
|
Blabbermouth::Blabber.increment('key', 1, :test, :rails)
|
104
|
-
expect(Blabbermouth::
|
105
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
104
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:increment, 'key', 1)).to be_true
|
105
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :increment, 'key', 1))
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
describe '.count' do
|
110
|
-
it 'blabs to any provided
|
110
|
+
it 'blabs to any provided bystanders' do
|
111
111
|
Blabbermouth::Blabber.count('key', 1, :test, :rails)
|
112
|
-
expect(Blabbermouth::
|
113
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
112
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:count, 'key', 1)).to be_true
|
113
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :count, 'key', 1))
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
describe '.time' do
|
118
|
-
it 'blabs to any provided
|
118
|
+
it 'blabs to any provided bystanders' do
|
119
119
|
Blabbermouth::Blabber.time('key', 1, :test, :rails)
|
120
|
-
expect(Blabbermouth::
|
121
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
120
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:time, 'key', 1)).to be_true
|
121
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :time, 'key', 1))
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe Blabbermouth::
|
3
|
+
RSpec.describe Blabbermouth::Bystanders::Base do
|
4
4
|
describe '#error' do
|
5
5
|
it 'raises NotImplementedError' do
|
6
6
|
expect { subject.error('key', StandardError.new) }.to raise_exception(NotImplementedError)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe Blabbermouth::
|
3
|
+
RSpec.describe Blabbermouth::Bystanders::Stdout do
|
4
4
|
describe '#error' do
|
5
5
|
it 'outputs to STDOUT' do
|
6
6
|
expect(capture_stdout { subject.error('key', StandardError.new) }).to eql(subject.send(:log_message, :error, 'key', StandardError.new))
|
data/spec/blabbermouth_spec.rb
CHANGED
@@ -2,47 +2,47 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe Blabbermouth do
|
4
4
|
describe '#error' do
|
5
|
-
it 'blabs to any provided
|
5
|
+
it 'blabs to any provided bystanders' do
|
6
6
|
subject.error('key', StandardError.new, :rollbar, :rails)
|
7
7
|
error = ::Rollbar.errors.last
|
8
8
|
expect(error[0]).to be_an_instance_of(Blabbermouth::Error)
|
9
|
-
expect(Rails.logger.errors).to include(Blabbermouth::
|
9
|
+
expect(Rails.logger.errors).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :error, 'key', StandardError.new))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
describe '#info' do
|
14
|
-
it 'blabs to any provided
|
14
|
+
it 'blabs to any provided bystanders' do
|
15
15
|
subject.info('key', 'test', :rollbar, :rails)
|
16
16
|
info = ::Rollbar.infos.last
|
17
17
|
expect(info[0]).to be_an_instance_of(Blabbermouth::Info)
|
18
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
18
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :info, 'key', 'test'))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#increment' do
|
23
|
-
it 'blabs to any provided
|
23
|
+
it 'blabs to any provided bystanders' do
|
24
24
|
subject.increment('key', 1, :rollbar, :rails)
|
25
25
|
info = ::Rollbar.infos.last
|
26
26
|
expect(info[0]).to be_an_instance_of(Blabbermouth::Increment)
|
27
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
27
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :increment, 'key', 1))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#count' do
|
32
|
-
it 'blabs to any provided
|
32
|
+
it 'blabs to any provided bystanders' do
|
33
33
|
subject.count('key', 1, :rollbar, :rails)
|
34
34
|
info = ::Rollbar.infos.last
|
35
35
|
expect(info[0]).to be_an_instance_of(Blabbermouth::Count)
|
36
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
36
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :count, 'key', 1))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '#time' do
|
41
|
-
it 'blabs to any provided
|
41
|
+
it 'blabs to any provided bystanders' do
|
42
42
|
subject.time('key', 1, :rollbar, :rails)
|
43
43
|
info = ::Rollbar.infos.last
|
44
44
|
expect(info[0]).to be_an_instance_of(Blabbermouth::Time)
|
45
|
-
expect(Rails.logger.infos).to include(Blabbermouth::
|
45
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :time, 'key', 1))
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blabbermouth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -53,8 +53,8 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Flexible instrumentation/reporting library for pushing info, errors,
|
56
|
-
counts, timing, etc. to
|
57
|
-
custom
|
56
|
+
counts, timing, etc. to listening bystanders like Librato, Rollbar, New Relic, Rails
|
57
|
+
logs or any custom reporting class.
|
58
58
|
email:
|
59
59
|
- mark@markrebec.com
|
60
60
|
executables: []
|
@@ -63,19 +63,21 @@ extra_rdoc_files: []
|
|
63
63
|
files:
|
64
64
|
- lib/blabbermouth.rb
|
65
65
|
- lib/blabbermouth/blabber.rb
|
66
|
+
- lib/blabbermouth/bystanders.rb
|
67
|
+
- lib/blabbermouth/bystanders/base.rb
|
68
|
+
- lib/blabbermouth/bystanders/new_relic.rb
|
69
|
+
- lib/blabbermouth/bystanders/stdout.rb
|
66
70
|
- lib/blabbermouth/configuration.rb
|
67
71
|
- lib/blabbermouth/exceptions.rb
|
68
|
-
- lib/blabbermouth/gawkers.rb
|
69
|
-
- lib/blabbermouth/gawkers/base.rb
|
70
|
-
- lib/blabbermouth/gawkers/stdout.rb
|
71
72
|
- lib/blabbermouth/version.rb
|
72
73
|
- spec/blabbermouth/blabber_spec.rb
|
73
|
-
- spec/blabbermouth/
|
74
|
-
- spec/blabbermouth/
|
74
|
+
- spec/blabbermouth/bystanders/base_spec.rb
|
75
|
+
- spec/blabbermouth/bystanders/new_relic_spec.rb
|
76
|
+
- spec/blabbermouth/bystanders/stdout_spec.rb
|
75
77
|
- spec/blabbermouth_spec.rb
|
76
78
|
- spec/spec_helper.rb
|
79
|
+
- spec/support/bystander.rb
|
77
80
|
- spec/support/capture_stdout.rb
|
78
|
-
- spec/support/gawker.rb
|
79
81
|
homepage: http://github.com/markrebec/blabbermouth
|
80
82
|
licenses: []
|
81
83
|
metadata: {}
|
@@ -98,12 +100,13 @@ rubyforge_project:
|
|
98
100
|
rubygems_version: 2.2.2
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
|
-
summary: Blabs your business to
|
103
|
+
summary: Blabs your business to listening bystanders
|
102
104
|
test_files:
|
103
105
|
- spec/blabbermouth_spec.rb
|
104
106
|
- spec/spec_helper.rb
|
105
107
|
- spec/support/capture_stdout.rb
|
106
|
-
- spec/support/
|
108
|
+
- spec/support/bystander.rb
|
107
109
|
- spec/blabbermouth/blabber_spec.rb
|
108
|
-
- spec/blabbermouth/
|
109
|
-
- spec/blabbermouth/
|
110
|
+
- spec/blabbermouth/bystanders/base_spec.rb
|
111
|
+
- spec/blabbermouth/bystanders/new_relic_spec.rb
|
112
|
+
- spec/blabbermouth/bystanders/stdout_spec.rb
|