Created
August 9, 2017 07:43
-
-
Save egyjs/9c2934828d7470a4b89bd94bd4ab67d9 to your computer and use it in GitHub Desktop.
get all console.log in div
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
$("body").append('<ul style="background: #000; border: 3px groove #ccc; color: #ccc; display: block; width: 99%; height: 60px; overflow: scroll; margin: 0 auto; position: fixed; bottom: 0;" id="EL-console"></ul>'); | |
function htmlEncode(value){ | |
return $('<ul/>').text(value).html(); | |
} | |
var former = console.log; | |
console.log = function(msg){ | |
former(msg); | |
$("#EL-console").append("<li class='te'>" + msg + "</li>"); | |
$('.te:empty').remove(); | |
} | |
window.onerror = function(message, url, linenumber) { | |
console.log('<li class="EL-logError">'+"JavaScript error: " + message + " on line " + | |
linenumber + " for " + url + '</li>'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment