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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11c8c9e8fb6b5a93a48d76c078b9a257c6996454
4
- data.tar.gz: ae102849b1ac9bde80efee667eba44f09dd1fe3a
3
+ metadata.gz: 942d50f720fa1beb5f52c5723ce1d821435d28eb
4
+ data.tar.gz: 0cb7aef5c51a65527872c1cf1fea98de526fc38e
5
5
  SHA512:
6
- metadata.gz: 85a10b1419674989f942ba83a588257e7ad4130def0e4e9d79d7c3f3ee62d9a78f2b5b7befd3f6f9e0f2e46bbc71a545760b2136a284e8c014417029bcbdceca
7
- data.tar.gz: a3cac79e65e8d06058f64ee4778b2d8182528b52d89942f1b5674aa65c8904cc754a0d019719b992ced510f3e237a6eeafb005e07348364be0487cc29da18f5f
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] = 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] = nil
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module EXEL
3
- VERSION = '1.3.0'
3
+ VERSION = '1.3.1'
4
4
  end
@@ -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.0
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-21 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler