legion-logging 1.3.4 → 1.3.5
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/lib/legion/logging/methods.rb +27 -0
- data/lib/legion/logging/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a197403f8e3949ef6680892655b47cdfec6052dffcf32732c8d9d277c5eecc93
|
|
4
|
+
data.tar.gz: 3baa080b906527dc521b1f326f014469d2802cac0e16682cc3eb3b2354079894
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c63d0b3a21a3822f0f6e8226455b6d1f65a743094acd6d8669f4f8cda2a63e988503026b53c25084f9cd4c1bda0b87fcc94a6bc9afbe057736a713e7d4f1a31c
|
|
7
|
+
data.tar.gz: 1e76100161836d8e258fcb11a266f542bfc4e2df323a2830b3a54b649b2b0ea128613282f2fbebe8a0d5668200411fbfadcc92a152cd0fe1e3b0fea675a8de7d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Legion::Logging Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.5] - 2026-03-24
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Automatic PII/PHI redaction in log write path: all log methods (`debug`, `info`, `warn`, `error`, `fatal`, `unknown`) pass string messages through `Legion::Logging::Redactor.redact_string` when `logging.redaction.enabled` is `true` (default: `false`)
|
|
7
|
+
- `maybe_redact(message)` private helper on `Legion::Logging::Methods` — no-ops when redaction is disabled, `Redactor` is not defined, or message is not a string
|
|
8
|
+
- Hook callbacks (`on_warn`, `on_error`, `on_fatal`) receive already-redacted message so no PHI leaks through hook dispatch
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `redaction_enabled?` guards against recursive `Legion::Settings::Loader` initialization by checking `@loader` ivar directly before calling `dig`; prevents infinite recursion when settings bootstrap calls `Legion::Logging.warn`
|
|
12
|
+
|
|
3
13
|
## [1.3.4] - 2026-03-24
|
|
4
14
|
|
|
5
15
|
### Fixed
|
|
@@ -21,6 +21,7 @@ module Legion
|
|
|
21
21
|
return unless log.level < 1
|
|
22
22
|
|
|
23
23
|
message = yield if message.nil? && block_given?
|
|
24
|
+
message = maybe_redact(message)
|
|
24
25
|
message = Rainbow(message).blue if @color
|
|
25
26
|
writer = @async_writer
|
|
26
27
|
if writer&.alive?
|
|
@@ -34,6 +35,7 @@ module Legion
|
|
|
34
35
|
return unless log.level < 2
|
|
35
36
|
|
|
36
37
|
message = yield if message.nil? && block_given?
|
|
38
|
+
message = maybe_redact(message)
|
|
37
39
|
message = Rainbow(message).green if @color
|
|
38
40
|
writer = @async_writer
|
|
39
41
|
if writer&.alive?
|
|
@@ -47,6 +49,7 @@ module Legion
|
|
|
47
49
|
return unless log.level < 3
|
|
48
50
|
|
|
49
51
|
message = yield if message.nil? && block_given?
|
|
52
|
+
message = maybe_redact(message)
|
|
50
53
|
raw = message
|
|
51
54
|
message = Rainbow(message).yellow if @color
|
|
52
55
|
writer = @async_writer
|
|
@@ -63,6 +66,7 @@ module Legion
|
|
|
63
66
|
return unless log.level < 4
|
|
64
67
|
|
|
65
68
|
message = yield if message.nil? && block_given?
|
|
69
|
+
message = maybe_redact(message)
|
|
66
70
|
raw = message
|
|
67
71
|
message = Rainbow(message).red if @color
|
|
68
72
|
writer = @async_writer
|
|
@@ -79,6 +83,7 @@ module Legion
|
|
|
79
83
|
return unless log.level < 5
|
|
80
84
|
|
|
81
85
|
message = yield if message.nil? && block_given?
|
|
86
|
+
message = maybe_redact(message)
|
|
82
87
|
raw = message
|
|
83
88
|
message = Rainbow(message).darkred if @color
|
|
84
89
|
log.fatal(message)
|
|
@@ -87,6 +92,7 @@ module Legion
|
|
|
87
92
|
|
|
88
93
|
def unknown(message = nil)
|
|
89
94
|
message = yield if message.nil? && block_given?
|
|
95
|
+
message = maybe_redact(message)
|
|
90
96
|
message = Rainbow(message).purple if @color
|
|
91
97
|
writer = @async_writer
|
|
92
98
|
if writer&.alive?
|
|
@@ -113,6 +119,27 @@ module Legion
|
|
|
113
119
|
|
|
114
120
|
private
|
|
115
121
|
|
|
122
|
+
def maybe_redact(message)
|
|
123
|
+
return message unless message.is_a?(String)
|
|
124
|
+
return message unless redaction_enabled?
|
|
125
|
+
return message unless defined?(Legion::Logging::Redactor)
|
|
126
|
+
|
|
127
|
+
Legion::Logging::Redactor.redact_string(message)
|
|
128
|
+
rescue StandardError
|
|
129
|
+
message
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def redaction_enabled?
|
|
133
|
+
return false unless defined?(Legion::Settings)
|
|
134
|
+
|
|
135
|
+
loader = Legion::Settings.instance_variable_get(:@loader)
|
|
136
|
+
return false unless loader
|
|
137
|
+
|
|
138
|
+
loader.dig(:logging, :redaction, :enabled) == true
|
|
139
|
+
rescue StandardError
|
|
140
|
+
false
|
|
141
|
+
end
|
|
142
|
+
|
|
116
143
|
def build_hook_context(level, message)
|
|
117
144
|
return nil unless Legion::Logging::Hooks.enabled?
|
|
118
145
|
return nil if Legion::Logging::Hooks.hooks[level].empty?
|