Errors and utilities
Logging
| Level | What the SDK logs |
|---|---|
"debug" | Everything info logs, plus each request's URL, headers and JSON body, and each response's body. |
"info" | One line per attempt, with its status, time and request id, plus each retry, timeout, connection error and abort. |
"warn", "error" | Nothing yet: the SDK logs only at info and debug. |
"off" | Nothing. |
LOG_LEVELS lists the levels from most to least verbose, ["debug", "info", "warn", "error", "off"], and LogLevel is their union. A Logger has debug, info, warn and error methods that take a message and any values, so console fits.
Logs are redacted: Authorization, Proxy-Authorization and X-API-Key keep only their last four characters, Cookie, Set-Cookie and X-Upload-Token are hidden, and so is a token or session_token field in a response body. Everything else is logged as it is at debug, including state, a parse password you send and signed link URLs, so keep debug out of shared logs.
const client = new NaceClient({ logLevel: "info", logger: console });