exel 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/exel/logging.rb +4 -3
- data/lib/exel/version.rb +1 -1
- data/spec/exel/logging_spec.rb +12 -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: 942d50f720fa1beb5f52c5723ce1d821435d28eb
|
4
|
+
data.tar.gz: 0cb7aef5c51a65527872c1cf1fea98de526fc38e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c02c61169f110c8398f12d2ef89d10a9877625371e98e8db255e5358014dcab9d61ca4f61cdb09bc5e2c3b546c6b0c247b6c2b93d595978db11e08521ca94d
|
7
|
+
data.tar.gz: e7a29db4087b5e45424c5192d81d59372b7247373f4483077688ffb6f3406fd7db49540818d9e3c404f2c68dabe2309fbe833b945b0164906b6bb0cdff4aca27
|
data/lib/exel/logging.rb
CHANGED
@@ -38,14 +38,15 @@ module EXEL
|
|
38
38
|
|
39
39
|
# Sets a prefix to be added to any messages sent to the EXEL logger in the given block.
|
40
40
|
def self.with_prefix(prefix)
|
41
|
-
Thread.current[:exel_log_prefix]
|
41
|
+
Thread.current[:exel_log_prefix] ||= []
|
42
|
+
Thread.current[:exel_log_prefix].push(prefix)
|
42
43
|
yield
|
43
44
|
ensure
|
44
|
-
Thread.current[:exel_log_prefix]
|
45
|
+
Thread.current[:exel_log_prefix].pop
|
45
46
|
end
|
46
47
|
|
47
48
|
def self.prefix
|
48
|
-
Thread.current[:exel_log_prefix]
|
49
|
+
Thread.current[:exel_log_prefix]&.last
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
data/lib/exel/version.rb
CHANGED
data/spec/exel/logging_spec.rb
CHANGED
@@ -64,6 +64,18 @@ module EXEL
|
|
64
64
|
|
65
65
|
expect(Logging.prefix).to be_nil
|
66
66
|
end
|
67
|
+
|
68
|
+
it 'handles nesting' do
|
69
|
+
Logging.with_prefix('outer') do
|
70
|
+
expect(Logging.prefix).to eq('outer')
|
71
|
+
|
72
|
+
Logging.with_prefix('inner') do
|
73
|
+
expect(Logging.prefix).to eq('inner')
|
74
|
+
end
|
75
|
+
|
76
|
+
expect(Logging.prefix).to eq('outer')
|
77
|
+
end
|
78
|
+
end
|
67
79
|
end
|
68
80
|
end
|
69
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yroo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|