Environment-specific settings
We can specify that logger options are selected according to the client environment.
Use initOptions.js to select options for each environment:
//General logger options wlInitOptions.logger = {enabled: true, stringify: false}; //Environment specific logger options if (WL.Client.getEnvironment() === WL.Environment.IPHONE) { wlInitOptions.logger.stringify = true; } WL.Client.init(wlInitOptions);For other options that can take advantage of environment-specific settings, see Logger Android check and override Callback,Log message tags, Log package whitelist and blacklist, and Select log levels.
As examples, we can use environment-specific options settings to specify no logs in production, selected logs for development, and only error logs for testing:
//Change accordingly var CURRENT_ENV = 'production'; //General init options var wlInitOptions = {}; //General logger options wlInitOptions.logger = {enabled: true}; //Give the application a small speed boost by not logging in production if (CURRENT_ENV === 'production') { wlInitOptions.logger.enabled = false; } WL.Client.init(wlInitOptions);
Parent topic: Configure the MobileFirst Logger