Skip to content

Instantly share code, notes, and snippets.

@oliverpool
Last active March 6, 2017 16:42
Show Gist options
  • Save oliverpool/7572854d389935100a11dce4d342501d to your computer and use it in GitHub Desktop.
Save oliverpool/7572854d389935100a11dce4d342501d to your computer and use it in GitHub Desktop.
Display console.log output (useful on jsfiddle for instance)
function newLog(oldLog) {
return function() {
var args = Array.prototype.slice.call(arguments, 0);
document.getElementById('console-log').innerText += args.join(" ") + "\n";
oldLog.apply(this, args)
}
}
console.log = newLog(console.log)
console.error = newLog(console.error)
<p id="console-log" style="font-family: monospace;"></p>
@oliverpool
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment