Digioh has a “private console” system. By default, it does not immediately display messages to the console:
console.log(message); DIGIOH_API.log(message);
These two log calls both log to the private Digioh console. To print all messages in the private console, go to your browser’s developer tools and call this from the console command line. All stored logs will display:
DIGIOH_API.print()
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. 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. This ensures 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 see the output, they need to issue the above command in the browser on each pageview they want to look at the log output.
Related Reading: