Configure the MobileFirst Logger
We can configure how the MobileFirst Logger runs on a range of client operating systems by modifying WL.Logger methods.
- Set log level after IBM MobileFirst Platform Foundation starts
Logger is always on, but we can set the log level after IBM MobileFirst Platform Foundation starts.
- Select log levels
We can select from among various log levels.
- Log different data types
We can log a range of data types including numbers, strings, and arrays
- Set Logger priority
We can configure the Logger to display only warning and error log messages.
- Filter log levels
We can filter logs to display only logs of equal or lower priority, set by the level property.
- Log package whitelist and blacklist
We can associate a set of log messages with a specific part of the application.
- Create log for package
We can create a logger for a specific package.
- Stringify
We can convert arguments to strings using the stringify function.
- Callback
We can pass a callback function to WL.Logger.config that will be called after every log message.
- Log message tags
We can add context to a log message by appending the level tag, the package tag, or both.
- Method chaining
We can invoke multiple method calls by chaining logger methods.
- Pretty-print JSON objects
We can format JSON objects by enabling stringify.
- Print stack traces
We can print stack traces for certain objects.
- Logger Android check and override
Logger checks the operating system on which it is running to determine whether to use the Android logger. We can override this behavior.
- Environment-specific settings
We can specify that logger options are selected according to the client environment.
- JavaScript module example
View an example of how to use WL.Logger to add log messages to a JavaScript module.
Parent topic: Develop hybrid and web applications