Skip to content

Instantly share code, notes, and snippets.

@jxc876
Last active August 29, 2015 14:13
Show Gist options
  • Save jxc876/ce2715315ead2b990bfe to your computer and use it in GitHub Desktop.
Save jxc876/ce2715315ead2b990bfe to your computer and use it in GitHub Desktop.
Log on
/*
REQUIREMENTS:
---------
1) JQuery is required
2) Create a element with the id of "console-log"
EX: <div id="console-log"></div>
USAGE:
---------
console.log('hello');
OPTIONAL
---------
Add a .console-line class, EX:
.console-line {
font-family: monospace;
margin: 2px;
}
*/
console = {
count: 0,
consoleLine: "<p class=\"console-line\"></p>",
log: function (par1) {
$console = $("#console-log");
if (par1 !== null && typeof par1 === 'object') {
$console.append($(this.consoleLine).html(this.count+++': ' + JSON.stringify(par1)));
}
else {
$console.append($(this.consoleLine).html(this.count+++': ' + par1));
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment