21 console methods that run on all browsers and node


Run tests
The tests are currently passing for all browsers.

The following methods will be called if implemented, if they are not implemented or the console does not exist a "noop" will be called. It also deals with cross browser inconsistencies for console.profile. counsell.time is implemented to work in IE.

  • debug
  • error
  • info
  • log
  • warn
  • dir
  • dirxml
  • table
  • trace
  • assert
  • count
  • markTimeline
  • profile
  • profileEnd
  • time
  • timeEnd
  • timeStamp
  • group
  • groupCollapsed
  • groupEnd
  • clear

The counsell object will be added to the global in browser environments


That code can run on all environments including node (console.profile does not exist in node) and works with browserify.

If you don't like using counsell as a global just set console to the global counsell.

console = counsell;
//In IE 
console.time('a') ...

If you like this tiny library please checkout Luc JS and give some positive or negative feedback.