blabbermouth-rails 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 +4 -4
- data/lib/blabbermouth/rails/bystander.rb +13 -1
- data/spec/blabbermouth/rails/bystander_spec.rb +21 -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: fa7888002186a538b40a4e0980317ec768156938
|
4
|
+
data.tar.gz: d720244578affeb1df25e2c6a20f3268b32e6b57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30cd0e1be0008bb62ac928c9efb0132192b65f0de91dac5222b4cfe2acd6390e5ab94c2f252fccd47abef492b50a08e8d01249200b8d55a97a177acefbc78763
|
7
|
+
data.tar.gz: b78ae99326a970a91a6179acf3b9afa823562276c1d4feaccf8201f75e257bb48643e127a56f51b6d9a30ed14f46095caf93396f952847bdc29e9914f83b9df1
|
@@ -8,6 +8,18 @@ module Blabbermouth
|
|
8
8
|
relay :error, key, e, *args
|
9
9
|
end
|
10
10
|
|
11
|
+
def critical(key, e, *args)
|
12
|
+
relay :critical, key, e, *args
|
13
|
+
end
|
14
|
+
|
15
|
+
def warning(key, e=nil, *args)
|
16
|
+
relay :warning, key, e, *args
|
17
|
+
end
|
18
|
+
|
19
|
+
def debug(key, e=nil, *args)
|
20
|
+
relay :debug, key, e, *args
|
21
|
+
end
|
22
|
+
|
11
23
|
def info(key, msg=nil, *args)
|
12
24
|
relay :info, key, msg, *args
|
13
25
|
end
|
@@ -33,7 +45,7 @@ module Blabbermouth
|
|
33
45
|
|
34
46
|
def log(event, key, msg, data={})
|
35
47
|
message = log_message(event, key, msg, data)
|
36
|
-
if
|
48
|
+
if [:error, :critical].include?(event)
|
37
49
|
::Rails.logger.error(message)
|
38
50
|
else
|
39
51
|
::Rails.logger.info(message)
|
@@ -14,6 +14,27 @@ RSpec.describe Blabbermouth::Bystanders::Rails do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
describe '#critical' do
|
18
|
+
it 'uses the rails logger' do
|
19
|
+
subject.critical('key', StandardError.new)
|
20
|
+
expect(Rails.logger.errors).to include(subject.send(:log_message, :critical, 'key', StandardError.new))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#warning' do
|
25
|
+
it 'uses the rails logger' do
|
26
|
+
subject.warning('key', 'test')
|
27
|
+
expect(Rails.logger.infos).to include(subject.send(:log_message, :warning, 'key', 'test'))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#debug' do
|
32
|
+
it 'uses the rails logger' do
|
33
|
+
subject.debug('key', 'test')
|
34
|
+
expect(Rails.logger.infos).to include(subject.send(:log_message, :debug, 'key', 'test'))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
17
38
|
describe '#info' do
|
18
39
|
it 'uses the rails logger' do
|
19
40
|
subject.info('key', 'test')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blabbermouth-rails
|
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: blabbermouth
|