How to set log level of Cordova Console Plugin?


#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”? It is set to “WARN” by default (https://github.com/apache/cordova-plugin-console/blob/master/www/logger.js#L80) and therefore levels such as “INFO” do not get logged to the console. I could of course overwrite the plugin’s JS code after ionic build and set the level to “DEBUG” but that can’t be the best way doing it. Any suggestions?


#2

Not sure why you would want to do that. If the other log levels work, why not just not use info?


#3

Well, right now one can only use LOG, ERROR and WARN as the log level is set to WARN.
INFO and DEBUG are below WARN and therefore can’t be used.

  • logger.LOG
  • logger.ERROR
  • logger.WARN
  • logger.INFO
  • logger.DEBUG

The more log levels you have available the more granular you can define your log messages.


#4

Well, right now one can only use LOG, ERROR and WARN as the log level is set to WARN.
INFO and DEBUG are below WARN and therefore can’t be used.

  • logger.LOG
  • logger.ERROR
  • logger.WARN
  • logger.INFO
  • logger.DEBUG

The more log levels you have available the more granular you can define your log messages.


#5

True, but most of your development does happen in the browser, where the plugin wouldn’t work. But if you need it to work once its on a device, then yes, you would need to edit the plugin.