Skip to content

Instantly share code, notes, and snippets.

@jfuerth
Created April 24, 2018 14:24
Show Gist options
  • Save jfuerth/cc04b6d83ed4fe758466c07c07195c43 to your computer and use it in GitHub Desktop.
Save jfuerth/cc04b6d83ed4fe758466c07c07195c43 to your computer and use it in GitHub Desktop.
Javascript console wedge for embedded browsers that don't support remote dev tools
if (!console.olog) { // eslint-disable-line no-console
const escapeHtml = str => `${str}`.replace('&', '&amp;').replace('<', '&lt;');
console.olog = console.log; // eslint-disable-line no-console
console.log = (msg, ...args) => { // eslint-disable-line no-console
console.olog(msg, ...args); // eslint-disable-line no-console
document.getElementById('debugDiv').innerHTML += `<p>${escapeHtml(msg)} ${escapeHtml(args)}</p>`;
};
console.debug = console.log; // eslint-disable-line no-console
console.info = console.log; // eslint-disable-line no-console
console.warn = console.log; // eslint-disable-line no-console
console.error = console.log; // eslint-disable-line no-console
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment