lumberjack_capture_device 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/VERSION +1 -1
- data/lib/lumberjack_capture_device.rb +41 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f40306e5addb7cd7a23f739e937f26c6f42ab6a7dc2836cf0e9c128fa0835541
|
4
|
+
data.tar.gz: 282b90a7dfe1de511806b0dbf1a8597c6ab7a00a9a031e64f642242fe686b3f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddfc01f72e76421232add226ed4d6d8158119883aea02483469d86c8fad428654c576c0df91441acfa3b2332ea3e696419651adfa61549dfd499bda43f7062df
|
7
|
+
data.tar.gz: 8f8b915dfebdb33f58d0f06a143f9a61a919fd503319d2eb74157f221afaba19e30c66884915b682ae772ba6c2fbbea66fabfd3a073c42cde3b57f9398d89589
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 1.1.1
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Handle tag array comparison when an array contains hashes to consistently convert the hash keys to strings. Otherwise array hashes were being treated differently that other tag structures.
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
|
15
|
+
- Improved the `inspect` method to provide a clearer representation of captured log entries to make debugging tests easier.
|
16
|
+
|
7
17
|
## 1.1.0
|
8
18
|
|
9
19
|
### Added
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
@@ -118,14 +118,25 @@ module Lumberjack
|
|
118
118
|
matches
|
119
119
|
end
|
120
120
|
|
121
|
+
def inspect
|
122
|
+
message = +"<##{self.class.name} #{@buffer.size} #{(@buffer.size == 1) ? "entry" : "entries"} captured:"
|
123
|
+
@buffer.each do |entry|
|
124
|
+
message << "\n #{formatted_entry(entry)}"
|
125
|
+
end
|
126
|
+
message << "\n>"
|
127
|
+
message
|
128
|
+
end
|
129
|
+
|
121
130
|
private
|
122
131
|
|
123
132
|
def matched?(entry, message_filter, level_filter, tags_filter)
|
124
133
|
return false unless match?(entry.message, message_filter)
|
125
134
|
return false unless match?(entry.severity, level_filter)
|
126
135
|
|
127
|
-
|
128
|
-
|
136
|
+
if tags_filter.is_a?(Hash)
|
137
|
+
tags_filter = deep_stringify_keys(Lumberjack::Utils.expand_tags(tags_filter))
|
138
|
+
end
|
139
|
+
tags = deep_stringify_keys(Lumberjack::Utils.expand_tags(entry.tags))
|
129
140
|
|
130
141
|
return false unless match_tags?(tags, tags_filter)
|
131
142
|
|
@@ -150,7 +161,7 @@ module Lumberjack
|
|
150
161
|
else
|
151
162
|
false
|
152
163
|
end
|
153
|
-
elsif value_filter.nil? || (value_filter.is_a?(
|
164
|
+
elsif value_filter.nil? || (value_filter.is_a?(Enumerable) && value_filter.empty?)
|
154
165
|
tag_values.nil? || (tag_values.is_a?(Array) && tag_values.empty?)
|
155
166
|
elsif tags.include?(name)
|
156
167
|
match?(tag_values, value_filter)
|
@@ -159,5 +170,32 @@ module Lumberjack
|
|
159
170
|
end
|
160
171
|
end
|
161
172
|
end
|
173
|
+
|
174
|
+
def deep_stringify_keys(hash)
|
175
|
+
if hash.is_a?(Hash)
|
176
|
+
hash.each_with_object({}) do |(key, value), result|
|
177
|
+
new_key = key.to_s
|
178
|
+
new_value = deep_stringify_keys(value)
|
179
|
+
result[new_key] = new_value
|
180
|
+
end
|
181
|
+
elsif hash.is_a?(Enumerable)
|
182
|
+
hash.collect { |item| deep_stringify_keys(item) }
|
183
|
+
else
|
184
|
+
hash
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def formatted_entry(entry)
|
189
|
+
timestamp = entry.time.strftime("%Y-%m-%d %H:%M:%S")
|
190
|
+
formatted = +"#{timestamp} #{entry.severity_label}: #{entry.message}"
|
191
|
+
formatted << "\n progname: #{entry.progname}" if entry.progname.to_s != ""
|
192
|
+
formatted << "\n pid: #{entry.pid}" if entry.pid
|
193
|
+
if entry.tags && !entry.tags.empty?
|
194
|
+
Lumberjack::Utils.flatten_tags(entry.tags).to_a.sort_by(&:first).each do |name, value|
|
195
|
+
formatted << "\n #{name}: #{value}"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
formatted
|
199
|
+
end
|
162
200
|
end
|
163
201
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lumberjack_capture_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.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: 2025-07-
|
11
|
+
date: 2025-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lumberjack
|