Skip to content

Instantly share code, notes, and snippets.

@JosePedroDias
Created Jan 18, 2019
Embed
What would you like to do?
basic logging to document
function log(...args) {
// console.log.apply(console, args);
args = args.map((arg) =>
typeof arg === 'object' ? JSON.stringify(arg) : arg
);
const preEl = document.createElement('pre');
const codeEl = document.createElement('code');
codeEl.appendChild(document.createTextNode(args.join(' ')));
preEl.appendChild(codeEl);
document.body.appendChild(preEl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment