Skip to content

Commit

Permalink
Bug: slight refactor for redability
Browse files Browse the repository at this point in the history
  • Loading branch information
jebentier committed Apr 29, 2020
1 parent e1008da commit 15902a8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/contextual_logger/redactor.rb
Expand Up @@ -32,16 +32,17 @@ def redact(log_entry)
when true, false
log_entry
else
log_entry_string = log_entry.to_s
if log_entry_string.match?(redaction_regex)
log_entry_string.to_s.gsub(redaction_regex, REDACTED_STRING)
else
log_entry_string
end
redact_string_if_needed(log_entry.to_s)
end
else
log_entry
end
end

private

def redact_string_if_needed(log_entry)
log_entry.match?(redaction_regex) ? log_entry.gsub(redaction_regex, REDACTED_STRING) : log_entry
end
end
end

0 comments on commit 15902a8

Please sign in to comment.