Skip to content

Instantly share code, notes, and snippets.

@remmi11
Forked from waynegraham/console.js
Created January 25, 2016 21:13
Show Gist options
  • Save remmi11/4cf2b512ab101bffcf29 to your computer and use it in GitHub Desktop.
Save remmi11/4cf2b512ab101bffcf29 to your computer and use it in GitHub Desktop.
print console.log output to a debug div (for mobile)
if (typeof console != "undefined")
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function() {};
console.log = function(message) {
console.olog(message);
$('#debugDiv').append('<p>' + message + '</p>');
};
console.error = console.debug = console.info = console.log
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
#debugDiv {height: 200px; width: 500px; border: 1px solid #333; overflow:scroll;}
</style>
<script src="console.js"></script>
</head>
<body>
<div id="debugDiv"></div>
<script>
console.log('test');
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment