Skip to main content

redactAttributes()

function redactAttributes(attributes: Attributes | undefined): Attributes | undefined;

Defined in: src/lib/logging/redaction.ts:861

Redacts sensitive information from log attributes.

Parameters

ParameterTypeDescription
attributesAttributes | undefinedThe attributes to redact.

Returns

Attributes | undefined

The redacted attributes, or undefined if input was undefined.

Example

const safe = redactAttributes({
    userId: 123,
    email: "user@example.com",
    password: "secret123",
    data: {
        nested: {
            ssn: "123-45-6789"
        }
    }
});
// Result:
// {
//     userId: 123,
//     email: "us***@***.com",
//     password: "[REDACTED]",
//     data: {
//         nested: {
//             ssn: "***-**-6789"
//         }
//     }
// }