klogger-logger 1.2.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
  SHA256:
3
- metadata.gz: d829e62b7472acd3c8c20e0ce8d5e3719c3bf2a5fa6752f23c503b64e56db99f
4
- data.tar.gz: d8a76281e8ac428c1c5ffacffcc6edc24c3404742e755a5f831287aa0b1862d6
3
+ metadata.gz: 05fcc83ebb5b6dcc9d947576d52b6d14ddd47c89de9ccfbe361df9dc1f9f33ed
4
+ data.tar.gz: f3f0d69f3427200dc9bbc74dee90f7dc8ad63aeb1364d8a47ec4c81e463189fb
5
5
  SHA512:
6
- metadata.gz: 58b478bddf41b569b4af77b0ef19ca70fccfd4b4f06f31d12c8c411f00f31ef1943f662f264b176e21c9df8087965187e525ddb11f4fad50a4b8e55fa00dcc98
7
- data.tar.gz: 73cf53c1c9bd298e5b09518e2ce7f7903d077b9c81648a156a1ea1da61b20f9a287ec3e0cea5a3acde0b97a544f449b1b295466f978741db1b7862e9792a5b6b
6
+ metadata.gz: c7e688edcf1a9454b422b9aefa6e687298b133a7f847b5c2f6dd0717a1afae395dd83ff68b639a238256e7f1a70f130ae5de18c779cbe6ac3f7c53f824631558
7
+ data.tar.gz: 77a325bb4eada003e7bfd46a47ec662db1436a4d85c9e12ce2da6bd7a1d5a8ba6d7bbe8ea5f79d73dbadff1baa6adebc1e968bbdc06da2f11e47bcd0b74e235b
@@ -13,6 +13,13 @@ module Klogger
13
13
  @groups.value
14
14
  end
15
15
 
16
+ def call_without_id(**tags)
17
+ add_without_id(**tags)
18
+ yield
19
+ ensure
20
+ pop
21
+ end
22
+
16
23
  def call(**tags)
17
24
  add(**tags)
18
25
  yield
@@ -26,6 +33,11 @@ module Klogger
26
33
  id
27
34
  end
28
35
 
36
+ def add_without_id(**tags)
37
+ @groups.value += [{ tags: tags }]
38
+ nil
39
+ end
40
+
29
41
  def pop
30
42
  @groups.value.pop
31
43
  end
@@ -59,6 +59,10 @@ module Klogger
59
59
  @group_set.pop
60
60
  end
61
61
 
62
+ def tagged(**tags, &block)
63
+ @group_set.call_without_id(**tags, &block)
64
+ end
65
+
62
66
  def silence!
63
67
  @silenced.value = true
64
68
  yield if block_given?
@@ -140,7 +144,7 @@ module Klogger
140
144
  [Klogger.global_groups, @group_set].each do |group_set|
141
145
  group_set.groups.each do |group|
142
146
  payload.merge!(group[:tags])
143
- group_ids << group[:id]
147
+ group_ids << group[:id] if group[:id]
144
148
  end
145
149
  end
146
150
 
data/lib/klogger.rb CHANGED
@@ -16,4 +16,8 @@ module Klogger
16
16
  global_groups.call(**tags, &block)
17
17
  end
18
18
 
19
+ def self.tagged(**tags, &block)
20
+ global_groups.call_without_id(**tags, &block)
21
+ end
22
+
19
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klogger-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke