Scribe.js/examples/run.js

27 lines
778 B
JavaScript
Raw Normal View History

2014-10-24 13:40:12 +02:00
/*jshint -W079 */
2014-10-23 22:03:48 +02:00
/**
* The main file
*/
2014-10-26 12:25:22 +01:00
require('../scribe')(); //loads Scribe
2014-10-24 13:40:12 +02:00
2014-10-26 12:25:22 +01:00
var console = process.console; //create a local (for the module) console
2014-10-24 13:40:12 +02:00
2014-10-26 12:25:22 +01:00
//Don't worry, you can still access the original console
2014-10-23 22:03:48 +02:00
global.console.log("I'm using the original console.log()");
//Let's create a new logger `myLoger` ...
console.addLogger('myLogger');
//... and use it !
console.tag('MyTag').time().file().myLogger('Scribe.js is awesome');
//Let's see how to use the new console in a sub-module :
//(just open submodules to see what's going on there)
//By default, submodules still use original console
require('./sub-without_new_console').saySomething("Hello world !");
//But, you can use the new one !
require('./sub-with_new_console').saySomething("Hello world !");