redacting-logger 1.0.0 → 1.1.0

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: '0913f102f2fa739214c54f742359f8771cc84212e9a8fcdd05eeff041b54a42d'
4
- data.tar.gz: 8bc325f2c2fb50c9e32f70abe8ba4d6ac8236597a8a3bb43c90179cdb516ea53
3
+ metadata.gz: d88bd6e2d2e1c5fc186f05de1c0edb096d69399c6cb341eebfee809e2e46ab05
4
+ data.tar.gz: af491b9b0ceb4a9d4800fdd102ae1560c90f4d4eb107dd5e3f6b82da0a03627a
5
5
  SHA512:
6
- metadata.gz: 5b3abad7e1a467c4bf63ee3aea78a790b04cd83799199c79bf91e6e1ae9617f6081cd83bcb09acafaee5e0ba579028ffb78a89f75b289bc0924fde6918eb92a7
7
- data.tar.gz: f5ea63ec3062cc32284a73b05f991ae5b05e1987cfa0c009b7d3d3629cacd9854e71e375f099e5f5b0cfc2421e7f38964b9b11e32d0abd43547b897837b8c676
6
+ metadata.gz: 1361b56a1c97dac3f910ebbbcb65652caea545bd2178cc12b61ae8725e0c99e4d06a3d6114c94349e1292adc795eb7802127255ffeaaafac8146ea866f8e3804
7
+ data.tar.gz: 282b6cb2221ecfa793acee8232da60f0e70c0c9c396889f2dd725b37cd9cb1e7bb67a0159f64c40ada9748b67f849e8ba42aaaa7853fc4907d39df8c588c9ab5
@@ -35,14 +35,26 @@ class RedactingLogger < Logger
35
35
  # Adds a message to the log.
36
36
  #
37
37
  # @param severity [Integer] The severity level of the message.
38
- # @param message [String] The message to log.
38
+ # @param message [String|Array|Hash] The message to log.
39
39
  # @param progname [String] The name of the program.
40
40
  def add(severity, message = nil, progname = nil)
41
41
  message, progname = yield if block_given?
42
42
 
43
- if message
44
- @redact_patterns.each do |pattern|
43
+ @redact_patterns.each do |pattern|
44
+ case message
45
+
46
+ when String
45
47
  message = message.to_s.gsub(pattern, @redacted_msg)
48
+
49
+ when Array
50
+ message = message.map do |m|
51
+ m = m.to_s.gsub(pattern, @redacted_msg)
52
+ end
53
+
54
+ when Hash
55
+ message = message.map do |k, v|
56
+ [k, v.to_s.gsub(pattern, @redacted_msg)]
57
+ end.to_h
46
58
  end
47
59
  end
48
60
 
data/lib/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RedactingLogger
4
4
  module Version
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redacting-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-22 00:00:00.000000000 Z
12
+ date: 2023-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logger