Coding & developmentObservabilitycode

Keep secrets out of application logs

Tests specific error paths for sensitive output.

Editorial illustration for Keep secrets out of application logs
Editorial illustration for this prompt; the prompt itself does not generate this image.

Ready to use

Prompt

Inputs: [LOGGING CODE], [SENSITIVE FIELDS], [SAMPLE EVENTS]. Map fields and exception paths, then design redaction tests using fake credentials and payloads. Preserve useful diagnostics without raw secrets. Output: A field policy, test cases and local code suggestions. Check: No test log includes the synthetic secret in full or fragments. If essential information is missing, identify it rather than filling the gap with a guess. Cover nested fields and exception messages, not only the normal structured logging path.