by b0gb · 1y ago · 0 comments
secrets.forEach(secret => logMessage = logMessage.replaceAll(secret, '**'))
secrets can also churn, so even if you did your example would require something besides an in-memory array.
and, the final point: what if your secret masking code fails on an exception, too ;)