lumberjack 1.2.1 → 1.2.2

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: 72793f91350cf3b30baede6fb2463d4c3456767445997ea9575a9914e81b5064
4
- data.tar.gz: e26eb87f8ce64b37010728c650a3c152ca8e79f068af057f37053aabfdff7e5a
3
+ metadata.gz: 12dffa9034387deb6cfc49976ce1bf2c90b35e9a255ac2f4c1a4730cd3de2a24
4
+ data.tar.gz: 1c7d4f246228a9b1d0f35e1618afc245e202d496617590d3d876e1b99b67e6c2
5
5
  SHA512:
6
- metadata.gz: d432507622e800253e8533f2effa884c00cb890acc4fe94031b5b65c811737f544c1cf6174b90d7dc328e62654a6258e6ebd327a7e5e64a8958484579977c2d3
7
- data.tar.gz: af4aee97287aa70c9af2a655ac55ccf38d39a9469d5aedffab3452365b26c89b184fad05a483611b3a500e1af89f1c33b2a23343d70112694f735ae02927189c
6
+ metadata.gz: 24d8eb348cfea7edeba9469e8d7d4c77717aa0b1045050dbce5ecc52f4e53e4c510bb1f8ecf23ea1e3886a7b8bbf0f21870fa1d2f0e964ec4e3dbb0d8af2f8f5
7
+ data.tar.gz: cbae4aede2f52a4abf45d3a92729aedbba25a1ef9c58020ab1d120f83bea610e1b83ee10cdc0b35a3ad698685cad6b92925cdaf9009ae1b47cc80f3985e9c4e8
@@ -1,3 +1,7 @@
1
+ ## 1.2.2
2
+
3
+ * Prevent infinite loops in the structured formatter where objects have backreferences to each other.
4
+
1
5
  ## 1.2.1
2
6
 
3
7
  * Prevent infinite loops where logging a statement triggers the logger.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -11,15 +11,29 @@ module Lumberjack
11
11
  end
12
12
 
13
13
  def call(obj)
14
+ call_with_references(obj, Set.new)
15
+ end
16
+
17
+ private
18
+
19
+ def call_with_references(obj, references)
20
+ references << obj
14
21
  if obj.is_a?(Hash)
15
22
  hash = {}
16
- references ||= Set.new
17
23
  obj.each do |name, value|
18
- hash[name.to_s] = call(value)
24
+ next if references.include?(value)
25
+ references << value
26
+ hash[name.to_s] = call_with_references(value, references)
19
27
  end
20
28
  hash
21
29
  elsif obj.is_a?(Enumerable) && obj.respond_to?(:size) && obj.size != Float::INFINITY
22
- obj.collect { |element| call(element) }
30
+ array = []
31
+ obj.each do |value|
32
+ next if references.include?(value)
33
+ references << value
34
+ array << call_with_references(value, references)
35
+ end
36
+ array
23
37
  elsif @formatter
24
38
  @formatter.format(obj)
25
39
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-27 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec