Skip to content

Instantly share code, notes, and snippets.

@jairoFernandez
Created June 4, 2018 01:30
Show Gist options
  • Save jairoFernandez/9808cd0fa487811ba68e5e4220689f6e to your computer and use it in GitHub Desktop.
Save jairoFernandez/9808cd0fa487811ba68e5e4220689f6e to your computer and use it in GitHub Desktop.
Imprimir consola
(function () {
if (!console) {
console = {};
}
var old = console.log;
var logger = document.getElementById('log');
console.log = function (message) {
if (typeof message == 'object') {
logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(message) : String(message)) + '<br />';
} else {
logger.innerHTML += message + '<br />';
}
}
})();
console.log("Hola")
console.log('test');
console.log({
test: 2
});
console.log([1, 2, 3]);
console.log([{
test: 1
}, {
test: 2
}]);
<div id="log"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment