Another Simple console.log wrapper – debug log for all browsers
Issues:
1. You can add console.log all day long but at the end of the day you have to remove them.
2. When testing on IE, you got to comment out or remove console.log otherwise it will error out.
3. for IE, you might end up adding Alert(msg). Clicking Alert could become painful.
Solution (might not be the best but works):
So I wrote Another simple console.log wrapper that meets what I need for now (super super simple)
Out put on IE would look like this:

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<title>Fun with Debugging</title>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>
<style type=”text/css”>
.console{
font-family:monospace;
font-size:12px;
color:white;
background-color:black;
padding: 0 0 0 10px;
}
</style>
</head>
<body class=’body’>
<h1>Header</h1>
<p>contents here</p>
</body>
<script>
var debug = {
debug: false,
log: function(msg){
if (this.debug){
if(window.console){
console.log(msg)
}else{
$(‘body’).append(‘<div class=”console”>’ + msg + ‘</div>’);
}
}
},
enable: function(){this.debug = true},
disable: function(){this.debug = false}
}debug.enable(); // remove or comment out before send to prod or just remove all debug. line with grep or something
debug.log(‘ahoy’);
debug.log(‘more message’);
// debug.disabled();
debug.log(‘debug is disabled now’);
</script>
</html>

