Select log levels
We can select from among various log levels.
- Debug
- Add a debug message.
WL.Logger.debug('Loop finished'); // Loop finished.
- Log
- Add a log message.
WL.Logger.log('Got', response.statusCode, 'from server.'); // Got 200 from the server.
- Info
- Add an informative message.
WL.Logger.info('Public IP address is', getIpAddress()); // Public IP address is 192.168.1.102.
- Warn
- Add a warning message.
if (!window.indexedDB) { WL.Logger.warn('IndexedDB not supported, falling back to LocalStorage.'); // IndexedDB not supported, falling back to LocalStorage. }
- Error
- Add an error message.
try { // Code that may throw new Error('Something failed here.'). } catch (e) { WL.Logger.error('Caught an exception', e); // Caught an exception Error: Something failed here. }
Parent topic: Configure the MobileFirst Logger