Skip to content

Instantly share code, notes, and snippets.

@npgenx
Created February 5, 2016 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npgenx/266fb9bce8f013f24f80 to your computer and use it in GitHub Desktop.
Save npgenx/266fb9bce8f013f24f80 to your computer and use it in GitHub Desktop.
js: Trace ( Console.log) Debugger
var trace = {
output : false,
queue : [],
push: function(data){
trace.queue.push(data);
if(trace.output){
trace.post();
}
return
},
post: function(){
$.each(trace.queue, function(i,arr){
trace.log(arr);
});
trace.queue = [];
return
},
dump: function(){
trace.post();
return
},
log: function(data){
if (!window.console){
console = {
log: function() {}
}
};
console.log(data);
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment