Logging in MobileFirst hybrid applications (JavaScript)

improve this page | report issue

Logging example for hybrid applications (JavaScript)

Outputs to a browser JavaScript console, LogCat, or Xcode console

var MathUtils = function(){
    var logger = WL.Logger.create({pkg: 'MathUtils'});
    var sum = function(a, b){
        var sum = a + b;
        logger.debug('sum called with args ' + a + ' and ' + b + '. Returning ' + sum);
        return sum;

API calls for specific tasks

Log capture is enabled by default. To turn log capture on or off:

WL.Logger.config({capture: false})

The default capture level is DEBUG in development and FATAL in production. To control the capture level (verbosity):

WL.Logger.config({level: 'FATAL'})

Log sending is enabled by default. To turn automatic log sending on or off:

WL.Logger.config({autoSendLogs: false})

For more information about the WL.Logger API, see the Reference part of the user documentation.

Last modified on November 09, 2016