1

Does anyone know how to change the logLevel of the Cordova Plugin Console (https://github.com/apache/cordova-plugin-console) from "WARN" to "DEBUG"?

2 Answers2

0

Currently is not possible without modifying the console plugin.

You can add to console-via-logger.js (the one outside the platform directory):

console.setLevel = function(level) {
  logger.level(level);
};

And call it from your code as:

console.setLevel('DEBUG')

But note it'll only work from a device and the $log service won't work either. Only console.log, console.debug, console.info,...

A better alternative is enable the Safari Web Inspector in the device and remote inspect from Safari, and for Android use the Chrome ADB plugin.

IsidroGH
  • 2,037
  • 19
  • 27
0

You do not need to modify the plugin. You can set the log level with:

cordova.logger.level(cordova.logger.DEBUG);

If you are using AngularJS make sure that you bootstrap angular after the deviceReady event. The AngularJS $log service caches the reference to the console object but this is replaced by the cordova console plugin.

See: Cordova + Angularjs + Device Ready

Community
  • 1
  • 1
Betko
  • 1
  • 1