blabbermouth 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blabbermouth.rb +12 -0
- data/lib/blabbermouth/blabber.rb +12 -0
- data/lib/blabbermouth/exceptions.rb +12 -3
- data/lib/blabbermouth/version.rb +1 -1
- data/spec/blabbermouth/blabber_spec.rb +30 -0
- data/spec/support/bystander.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a49cd1a667c41b1a9c25a7c22fd77ef15a3cf04
|
4
|
+
data.tar.gz: 88ed1816bfc0cace3976dab094368fcb10fa3406
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c52dd93433055c7ad4a29754f73df102c1aaeee1afcf26fdbee3e52d87c6ec01e315c646ea477ead638d4c1f7283715cf697d978868e8ec8432fcaad6e3e6bf
|
7
|
+
data.tar.gz: 43f5b53d42531b6830bb0a0084235d4898e8dbaf2774f0d7b03427be9bc407d8353250e04a70212c0309915a7cf6d92d1cc541f83396cf3cd14b7008bec5e2db
|
data/lib/blabbermouth.rb
CHANGED
@@ -26,6 +26,18 @@ module Blabbermouth
|
|
26
26
|
Blabbermouth::Blabber.error key, e, *args
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.critical(key, e, *args)
|
30
|
+
Blabbermouth::Blabber.critical key, e, *args
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.warning(key, e=nil, *args)
|
34
|
+
Blabbermouth::Blabber.warning key, e, *args
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.debug(key, e=nil, *args)
|
38
|
+
Blabbermouth::Blabber.debug key, e, *args
|
39
|
+
end
|
40
|
+
|
29
41
|
def self.info(key, msg=nil, *args)
|
30
42
|
Blabbermouth::Blabber.info key, msg, *args
|
31
43
|
end
|
data/lib/blabbermouth/blabber.rb
CHANGED
@@ -76,6 +76,18 @@ module Blabbermouth
|
|
76
76
|
blab :error, key, e, *args
|
77
77
|
end
|
78
78
|
|
79
|
+
def critical(key, e, *args)
|
80
|
+
blab :critical, key, e, *args
|
81
|
+
end
|
82
|
+
|
83
|
+
def warning(key, e=nil, *args)
|
84
|
+
blab :warning, key, e, *args
|
85
|
+
end
|
86
|
+
|
87
|
+
def debug(key, e=nil, *args)
|
88
|
+
blab :debug, key, e, *args
|
89
|
+
end
|
90
|
+
|
79
91
|
def info(key, msg=nil, *args)
|
80
92
|
blab :info, key, msg, *args
|
81
93
|
end
|
@@ -1,10 +1,19 @@
|
|
1
1
|
module Blabbermouth
|
2
2
|
class Error < ::StandardError
|
3
|
-
def initialize(key, e)
|
4
|
-
|
5
|
-
|
3
|
+
def initialize(key, e=nil)
|
4
|
+
if e.is_a?(Exception)
|
5
|
+
super("#{key}: #{e.class.name}: #{e.message}")
|
6
|
+
set_backtrace e.backtrace
|
7
|
+
else
|
8
|
+
super("#{key}: #{e.to_s}")
|
9
|
+
set_backtrace caller
|
10
|
+
end
|
6
11
|
end
|
7
12
|
end
|
13
|
+
class Debug < Error; end
|
14
|
+
class Warning < Error; end
|
15
|
+
class Critical < Error; end
|
16
|
+
|
8
17
|
class Info < ::StandardError
|
9
18
|
def initialize(key, msg)
|
10
19
|
super("#{key}: #{msg}")
|
data/lib/blabbermouth/version.rb
CHANGED
@@ -32,6 +32,36 @@ RSpec.describe Blabbermouth::Blabber do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
describe '#critical' do
|
36
|
+
it 'blabs to any added bystanders' do
|
37
|
+
subject.add_bystander!(:test)
|
38
|
+
subject.add_bystander!(:rails)
|
39
|
+
subject.critical('key', StandardError.new)
|
40
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:critical, 'key', StandardError.new.message)).to be_true
|
41
|
+
expect(Rails.logger.errors).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :critical, 'key', StandardError.new))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#warning' do
|
46
|
+
it 'blabs to any added bystanders' do
|
47
|
+
subject.add_bystander!(:test)
|
48
|
+
subject.add_bystander!(:rails)
|
49
|
+
subject.warning('key', StandardError.new)
|
50
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:warning, 'key', StandardError.new.message)).to be_true
|
51
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :warning, 'key', StandardError.new))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#debug' do
|
56
|
+
it 'blabs to any added bystanders' do
|
57
|
+
subject.add_bystander!(:test)
|
58
|
+
subject.add_bystander!(:rails)
|
59
|
+
subject.debug('key', StandardError.new)
|
60
|
+
expect(Blabbermouth::Bystanders::Test.logged?(:debug, 'key', StandardError.new.message)).to be_true
|
61
|
+
expect(Rails.logger.infos).to include(Blabbermouth::Bystanders::Rails.new.send(:log_message, :debug, 'key', StandardError.new))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
35
65
|
describe '#info' do
|
36
66
|
it 'blabs to any added bystanders' do
|
37
67
|
subject.add_bystander!(:test)
|
data/spec/support/bystander.rb
CHANGED
@@ -16,6 +16,21 @@ module Blabbermouth
|
|
16
16
|
log :error, key, e.message, data
|
17
17
|
end
|
18
18
|
|
19
|
+
def critical(key, e, *args)
|
20
|
+
data, opts, args = parse_args(*args)
|
21
|
+
log :critical, key, e.message, data
|
22
|
+
end
|
23
|
+
|
24
|
+
def warning(key, e=nil, *args)
|
25
|
+
data, opts, args = parse_args(*args)
|
26
|
+
log :warning, key, e.message, data
|
27
|
+
end
|
28
|
+
|
29
|
+
def debug(key, e=nil, *args)
|
30
|
+
data, opts, args = parse_args(*args)
|
31
|
+
log :debug, key, e.message, data
|
32
|
+
end
|
33
|
+
|
19
34
|
def info(key, msg=nil, *args)
|
20
35
|
data, opts, args = parse_args(*args)
|
21
36
|
log :info, key, msg, data
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|