Redacting the object before it's serialized makes sense, since regex on a flattened string always misses something. I'd also add a test that feeds known card and email samples through the logger and fails the build if any unmasked value shows up in the output.