paul_bunyan 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paul_bunyan/log_relayer.rb +13 -0
- data/lib/paul_bunyan/version.rb +1 -1
- data/spec/lib/paul_bunyan/log_relayer_spec.rb +16 -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: d8ea928ce32c34a63cd4b14dc3e2bf1636472539
|
4
|
+
data.tar.gz: fa38000b5ceecda0373c2a6c29d0f917f50c7ba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a7f5fb1dd233492d92daa32e25a67ce315eaf460d834924cb20771ed7c92bc287fad20f091373c00e60aa3ab5050e9d7114f633656a724820da9fa053822f16
|
7
|
+
data.tar.gz: e0e153759bbb4d25eb0005a3e69f768e48cb91f583642aa4938676d2ec2a4068e0311abb2661db1408c32cef4f82a978c89e2c29e60aa78ff62a4cc951bbd76a
|
@@ -95,6 +95,19 @@ module PaulBunyan
|
|
95
95
|
logger.nil? ? DEBUG : logger.level
|
96
96
|
end
|
97
97
|
|
98
|
+
def silence(level = Logger::ERROR, &block)
|
99
|
+
loggers = self.loggers.select { |l| l.respond_to?(:silence) }.reverse
|
100
|
+
silencer = proc do
|
101
|
+
logger = loggers.pop
|
102
|
+
if logger
|
103
|
+
logger.silence(level, &silencer)
|
104
|
+
else
|
105
|
+
block.call
|
106
|
+
end
|
107
|
+
end
|
108
|
+
silencer.call
|
109
|
+
end
|
110
|
+
|
98
111
|
module TaggedRelayer
|
99
112
|
def current_tags
|
100
113
|
tags = loggers.each_with_object(Set.new) do |logger, set|
|
data/lib/paul_bunyan/version.rb
CHANGED
@@ -330,4 +330,20 @@ describe PaulBunyan::LogRelayer do
|
|
330
330
|
end
|
331
331
|
end
|
332
332
|
end
|
333
|
+
|
334
|
+
context 'silence' do
|
335
|
+
describe '#silence' do
|
336
|
+
it 'calls silence on all loggers' do
|
337
|
+
expect(primary).to receive(:silence).with(Logger::WARN) { |&b| b.call }
|
338
|
+
expect(secondary).to receive(:silence).with(Logger::WARN) { |&b| b.call }
|
339
|
+
expect { |b| double_relayer.silence(Logger::WARN, &b) }.to yield_control
|
340
|
+
end
|
341
|
+
|
342
|
+
it 'skips loggers without a #silence method' do
|
343
|
+
allow(secondary).to receive(:respond_to?) { false }
|
344
|
+
expect(primary).to receive(:silence).with(Logger::WARN) { |&b| b.call }
|
345
|
+
expect { |b| double_relayer.silence(Logger::WARN, &b) }.to yield_control
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
333
349
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paul_bunyan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duane Johnson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-06-
|
14
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: request_store
|