How do I output messages to console from Custom JS?

Digioh’s has a “private console” system that by default does not immediately display messages to the console:

console.log(message);
DIGIOH_API.log(message);

These two log calls do the same thing, log to the private Digioh console. To print all messages in the private console, from chrome/firefox/etc developer tools, call this from the console command line and all stored logs will display:

DIGIOH_API.print()

console command line

Different log levels are available. Log ERROR messages from Custom JS. ERRORs will automatically stream in real time to the browser console without needing to issue a print command, in addition to logging to the private console.

DIGIOH_API.logError(message);

Notes:

  • Log messages will never display in the console unless the above command is issued in the browser console, or they are logged as ERROR.
  • Once the above command is issued in the browser console, all queued log messages will print in order, and then all subsequent log messages will automatically stream to the browser console output as they occur in real time, until the page is reloaded or navigated away from.
  • Error messages due to JavaScript exceptions, etc, will automatically print to the console without needing to issue any commands, to ensure we are always aware of any issues as they occur. Error messages can be identified by the text “ERROR::::” at the beginning of each line.
  • Developers can use the special error message logging if they so desire, by making a call to the “DIGIOH_API.logError(message)” function.
  • Anywhere that you use “console.log” in Custom JS, we have overridden that with a hidden local variable. This means anywhere our developers have accidentally left hanging “console.log” messages, they will all be contained within our private logging system.
  • Developers can continue to use “console.log” within Custom JS, as they are most familiar with that, and don’t have to think about changing syntax. The only caveat is that to actually see the output, they will need to issue the above command in the browser on each pageview they want to look at the log output.