Converts a value to a JSON-safe form for structured logging.
The function uses customJson first and custom second.
It handles dates, errors, functions, symbols, and circular references. When
conversion fails, it returns an inspected string instead of throwing.
A customJson implementation can call this function to convert nested
values.
This function does not redact ordinary object properties. Objects that can
contain credentials must provide a safe customJson method or be
sanitized before logging.
Converts a value to a JSON-safe form for structured logging.
The function uses customJson first and custom second. It handles dates, errors, functions, symbols, and circular references. When conversion fails, it returns an inspected string instead of throwing. A customJson implementation can call this function to convert nested values.
This function does not redact ordinary object properties. Objects that can contain credentials must provide a safe customJson method or be sanitized before logging.