Last active
September 6, 2017 12:18
-
-
Save airyboy/ee874574f0ec0fcb228965abd1ffc1ad to your computer and use it in GitHub Desktop.
Redirecting console.log output to a webpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre id="log"></pre> | |
(function(){ | |
var oldLog = console.log; | |
console.log = function (message) { | |
const logger = document.getElementById('log'); | |
logger.innerHTML += `> ${message}\n`; | |
oldLog.apply(console, arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment