Wednesday, May 18, 2016

OpenUI5 - Don't use console.log!

Sap has a built in logging functionality.   You can set your logging level and leave in all your log statements.

jQuery.sap.log.debug("onInit");
jQuery.sap.log.error("failed to get id");

Then you can set up your logging level in the javascript, so in dev/qa you could have:
jQuery.sap.log.setLevel(jQuery.sap.log.Level.DEBUG);
But in production, you can do:
jQuery.sap.log.setLevel(jQuery.sap.log.Level.NONE);