lumberjack 1.2.0 → 1.2.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: 10f2db93994b2941a8684c4fd933f07fc2d0067afdcfa3798f4ba3b5cc34b354
4
- data.tar.gz: e6413b5b475b1c05ffcc17662e4f553af8e6d47d79e961a5802d0d875a413f9e
3
+ metadata.gz: 72793f91350cf3b30baede6fb2463d4c3456767445997ea9575a9914e81b5064
4
+ data.tar.gz: e26eb87f8ce64b37010728c650a3c152ca8e79f068af057f37053aabfdff7e5a
5
5
  SHA512:
6
- metadata.gz: 809fc20f5cb8cc7d704f5a5e6878f321285953c8c79139fbd9892fa6c954b645b6bdcc0ce0e0265e18b29974fd864a96fdd735a424f57bd1224653759b139fd8
7
- data.tar.gz: c7cf6e570fe6a1cbba068905ad860c26ad375b5f413d449c8f77f84c4ad81b139585ef2917aa2328dac2b80e0a3f962895a5efb8c5b988a14605e59ccf6eafbc
6
+ metadata.gz: d432507622e800253e8533f2effa884c00cb890acc4fe94031b5b65c811737f544c1cf6174b90d7dc328e62654a6258e6ebd327a7e5e64a8958484579977c2d3
7
+ data.tar.gz: af4aee97287aa70c9af2a655ac55ccf38d39a9469d5aedffab3452365b26c89b184fad05a483611b3a500e1af89f1c33b2a23343d70112694f735ae02927189c
@@ -1,3 +1,7 @@
1
+ ## 1.2.1
2
+
3
+ * Prevent infinite loops where logging a statement triggers the logger.
4
+
1
5
  ## 1.2.0
2
6
 
3
7
  * Enable compatibility with ActiveSupport::TaggedLogger by calling `tagged_logger!` on a logger.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -156,32 +156,37 @@ module Lumberjack
156
156
  # logger.add_entry(:warn, "Request took a long time")
157
157
  # logger.add_entry(Logger::DEBUG){"Start processing with options #{options.inspect}"}
158
158
  def add_entry(severity, message, progname = nil, tags = nil)
159
- severity = Severity.label_to_level(severity) unless severity.is_a?(Integer)
160
-
161
- return true unless device && severity && severity >= level
162
-
163
- time = Time.now
164
- message = message.call if message.is_a?(Proc)
165
- message = formatter.format(message)
166
- progname ||= self.progname
167
-
168
- current_tags = self.tags
169
- tags = nil unless tags.is_a?(Hash)
170
- if current_tags.empty?
171
- tags = Tags.stringify_keys(tags) unless tags.nil?
172
- else
173
- if tags.nil?
174
- tags = current_tags.dup
159
+ begin
160
+ severity = Severity.label_to_level(severity) unless severity.is_a?(Integer)
161
+ return true unless device && severity && severity >= level
162
+
163
+ return true if Thread.current[:lumberjack_logging]
164
+ Thread.current[:lumberjack_logging] = true
165
+
166
+ time = Time.now
167
+ message = message.call if message.is_a?(Proc)
168
+ message = formatter.format(message)
169
+ progname ||= self.progname
170
+
171
+ current_tags = self.tags
172
+ tags = nil unless tags.is_a?(Hash)
173
+ if current_tags.empty?
174
+ tags = Tags.stringify_keys(tags) unless tags.nil?
175
175
  else
176
- tags = current_tags.merge(Tags.stringify_keys(tags))
176
+ if tags.nil?
177
+ tags = current_tags.dup
178
+ else
179
+ tags = current_tags.merge(Tags.stringify_keys(tags))
180
+ end
177
181
  end
178
- end
179
- tags = Tags.expand_runtime_values(tags)
180
- tags = tag_formatter.format(tags) if tag_formatter
181
-
182
- entry = LogEntry.new(time, severity, message, progname, $$, tags)
183
- write_to_device(entry)
182
+ tags = Tags.expand_runtime_values(tags)
183
+ tags = tag_formatter.format(tags) if tag_formatter
184
184
 
185
+ entry = LogEntry.new(time, severity, message, progname, $$, tags)
186
+ write_to_device(entry)
187
+ ensure
188
+ Thread.current[:lumberjack_logging] = nil
189
+ end
185
190
  true
186
191
  end
187
192
 
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.0
4
+ version: 1.2.1
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-20 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec