DescopeLogger class

The DescopeLogger class can be used to customize logging functionality in the Descope SDK.

The default behavior is for log messages to be written to the standard output using the print() function.

You can also customize how logging functions in the Descope SDK by creating a subclass of DescopeLogger and overriding the DescopeLogger.output method. See the documentation for that method for more details.

You can set the logger to DescopeLogger.basicLogger to print error and info log messages to the console.

If you encounter any issues you can also use DescopeLogger.debugLogger to enable more verbose logging. This will configure a simple logger that prints all logs to the console. If the app is built in debug mode it will also output potentially sensitive runtime values, such as full network request and response payloads, secrets and tokens in cleartext, etc.

In rare cases you might need to use DescopeLogger.unsafeLogger which skips the debug mode check and always prints all log data including all sensitive runtime values. Make sure you don't use DescopeLogger.unsafeLogger in release builds intended for production.

Constructors

DescopeLogger({int level = debug, bool unsafe = false})
Creates a new DescopeLogger object. Log level defaults to debug, unsafe defaults to false.

Properties

hashCode int
The hash code for this object.
no setterinherited
level int
The maximum log level that should be printed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unsafe bool
Whether to print unsafe runtime values.
getter/setter pair

Methods

log({required int level, required String message, List values = const []}) → void
Called by other code in the Descope SDK to output log messages.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
output({required int level, required String message, required List values}) → void
Formats the log message and prints it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

basicLogger DescopeLogger
A simple logger that prints basic error and info logs to the console.
final
debugLogger DescopeLogger
A simple logger that prints all logs to the console, but does not output any potentially unsafe runtime values unless the app is built in debug mode.
final
unsafeLogger DescopeLogger
A simple logger that prints all logs to the console, including potentially unsafe runtime values such as secrets, personal information, network payloads, etc.
final

Constants

debug → const int
error → const int
The severity of a log message.
info → const int