Logging
VWO by default logs all ERROR level messages to your device console. To gain more control over VWO's logging behavior, you can use the logger parameter in the init configuration.
Logger Properties
Parameter | Type | Description |
---|---|---|
level | String | Level or Type of error. Could be one of the following: DEBUG, INFO, ERROR, TRACE, WARN |
prefix | String | The text that is prefixed to the error messages when logged. Defaults to 'VWO-SDK'. |
Example 1: Set log level to control the verbosity of logs
vwoInitOptions.logger = mutableMapOf<String, Any>().apply {
put("level", "INFO") // DEBUG, INFO, ERROR, TRACE, WARN
}
Map<String, Object> loggerOptions = new HashMap<>();
loggerOptions.put("level", "INFO"); // DEBUG, INFO, ERROR, TRACE, WARN
vwoInitOptions.setLogger(loggerOptions);
Example 2: Add a custom prefix to log messages for easier identification
vwoInitOptions.logger = mutableMapOf<String, Any>().apply {
put("level", "INFO") // DEBUG, INFO, ERROR, TRACE, WARN
put("prefix", "VWO")
}
Map<String, Object> loggerOptions = new HashMap<>();
loggerOptions.put("level", "INFO"); // DEBUG, INFO, ERROR, TRACE, WARN
loggerOptions.put("prefix", "VWO");
vwoInitOptions.setLogger(loggerOptions);
This "logger" object can be passed as one of the parameters when initializing vwoClient.
Updated 4 days ago