example.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. //
  3. // Please run this example with the correct environment flag `DEBUG=*` or
  4. // `DEBUG=big*` or what ever. For example:
  5. //
  6. // ```
  7. // DEBUG=* node example.js
  8. // ```
  9. //
  10. var log;
  11. //
  12. // Ignore this piece of code, it's merely here so we can use the `diagnostics`
  13. // module if installed or just the index file of this repository which makes it
  14. // easier to test. Normally you would just do:
  15. //
  16. // ```js
  17. // var log = require('diagnostics');
  18. // ```
  19. //
  20. // And everything will be find and dandy.
  21. //
  22. try { log = require('diagnostics'); }
  23. catch (e) { log = require('./'); }
  24. //
  25. // In this example we're going to output a bunch on logs which are namespace.
  26. // This gives a visual demonstration.
  27. //
  28. [
  29. log('bigpipe'),
  30. log('bigpipe:pagelet'),
  31. log('bigpipe:page'),
  32. log('bigpipe:page:rendering'),
  33. log('bigpipe:primus:event'),
  34. log('primus'),
  35. log('primus:event'),
  36. log('lexer'),
  37. log('megatron'),
  38. log('cows:moo'),
  39. log('moo:moo'),
  40. log('moo'),
  41. log('helloworld'),
  42. log('helloworld:bar')
  43. ].forEach(function (log) {
  44. log('foo');
  45. });