From 2c53de8ee62f3ec7ab1673e9f6f783004bfad0ac Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Sun, 26 Oct 2014 12:25:22 +0100 Subject: [PATCH] Update examples --- examples/console2.js | 5 ++--- examples/run.js | 8 ++++---- examples/run_with_config.js | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 examples/run_with_config.js diff --git a/examples/console2.js b/examples/console2.js index b7aa9ed..b5fcd34 100644 --- a/examples/console2.js +++ b/examples/console2.js @@ -4,10 +4,9 @@ * Console2 functions */ -var scribe = require('../scribe'), //loads Scribe - console = process.console; //create a local (for the module) console +require('../scribe')(); //loads Scribe -scribe.config({}); +var console = process.console; //create a local (for the module) console console.addLogger('log'); diff --git a/examples/run.js b/examples/run.js index 771fedd..2f161b4 100644 --- a/examples/run.js +++ b/examples/run.js @@ -3,12 +3,12 @@ * The main file */ -var scribe = require('../scribe'), //loads Scribe - console = process.console; //create a local (for the module) console +require('../scribe')(); //loads Scribe -scribe.config({}); +var console = process.console; //create a local (for the module) console -//Don't worry, you can still acces the original console + +//Don't worry, you can still access the original console global.console.log("I'm using the original console.log()"); //Let's create a new logger `myLoger` ... diff --git a/examples/run_with_config.js b/examples/run_with_config.js new file mode 100644 index 0000000..d77f3d1 --- /dev/null +++ b/examples/run_with_config.js @@ -0,0 +1,23 @@ +/* jshint -W079 */ +/** + * With config + */ + +var scribe = require('../scribe')({ + createDefaultConsole : false //Scribe won't attach a fresh console2 to process.console +}); + +console.log(process.console); //undefined + +var myConfigConsole = scribe.console({ + + console : { //Default options for all myConfigConsole loggers + colors : ['rainbow', 'inverse', 'black'] + } + +}); + + +myConfigConsole.addLogger('fun'); + +myConfigConsole.fun('Some rainbow in background !');