blabbermouth 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a5bfa333e8f6df4835c7a15d3ba2f8755e31295
4
- data.tar.gz: ac14631dd69684f289575025eee8c5026a5a1be3
3
+ metadata.gz: 7a49cd1a667c41b1a9c25a7c22fd77ef15a3cf04
4
+ data.tar.gz: 88ed1816bfc0cace3976dab094368fcb10fa3406
5
5
  SHA512:
6
- metadata.gz: c293cdb0aa462933246b00f882156872f0326a115467a0b2d9b96983bd41d0453a48b35dfdb89123643be42d12785acc2a14a3c9689e7140f4bd73ab0283684e
7
- data.tar.gz: 146d5d21ae344c6f286a9b2dcb04f736d63dc646634a6d24b9e441e9850f935c7b9eda091806909435091ab1fdea62b40b90251d999b132ccd545b6d102a4f70
6
+ metadata.gz: 1c52dd93433055c7ad4a29754f73df102c1aaeee1afcf26fdbee3e52d87c6ec01e315c646ea477ead638d4c1f7283715cf697d978868e8ec8432fcaad6e3e6bf
7
+ data.tar.gz: 43f5b53d42531b6830bb0a0084235d4898e8dbaf2774f0d7b03427be9bc407d8353250e04a70212c0309915a7cf6d92d1cc541f83396cf3cd14b7008bec5e2db
@@ -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
@@ -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
- super("#{key}: #{e.message}")
5
- set_backtrace e.backtrace
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}")
@@ -1,3 +1,3 @@
1
1
  module Blabbermouth
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -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)
@@ -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.2
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-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport