Logging
The Passport SDK provides logging capabilities to monitor and troubleshoot its behaviour. You can configure the log level and choose to redact sensitive data.
Log Level
Use the LogLevel
property to control the severity of logged messages. The default level is LogLevel.Info
, which logs general information.
Available log levels:
LogLevel.Debug
: Detailed information for debugging.LogLevel.Info
: General SDK operation information.LogLevel.Warn
: Warnings about potential issues.LogLevel.Error
: Errors indicating SDK failures.
Example to set the log level to Debug
:
Passport.LogLevel = LogLevel.Debug;
Redacting Sensitive Token Values
To enhance security, the SDK allows you to redact sensitive token values (i.e. access and ID tokens) from logs. By default, tokens are logged in full.
Set the RedactTokensInLogs
property to true
to replace tokens with [REDACTED]
.
Example to enable token redaction:
Passport.RedactTokensInLogs = true;
This ensures sensitive data is not exposed in logs, especially during debugging or when sharing logs.