Update examples

This commit is contained in:
Guillaume Wuip 2014-10-26 16:52:08 +01:00
parent 30d39b8232
commit f484ca1028
2 changed files with 27 additions and 5 deletions

View file

@ -11,19 +11,29 @@ var console = process.console; //create a local (for the module) console
console.addLogger('log'); console.addLogger('log');
console.log("Hello"); console.log("Hello");
console.log("A string %s and a number %d", "hello", "123"); //you can use printf-like format
//Time
console.time().log("Print the full time"); console.time().log("Print the full time");
console.date().log("Just print the date"); console.date().log("Just print the date");
console.tag("Tag1", 123).log("Some Tag");
//Tags
console.tag("My Tag").log("Add a tag");
console.tag("Tag1", 'Tag2', 123).log("Or multiple tag");
console.tag({msg : 'my-tag', colors : ['red', 'inverse']}).log("Use colors.js colors");
//File and line number
console.file().log("Print the file and the line of the call"); console.file().log("Print the file and the line of the call");
//Object
console.log({just : 'an object'}); console.log({just : 'an object'});
//Combos !
console.log( console.log(
"Print many things", "Print many things",
{ key1 : "val 1", key2 : { a: "b", c : []}, key3 : [1234]}, { key1 : "val 1", key2 : { a: "b", c : []}, key3 : [1234]},
['an array'], ['an array'],
"A String" "A String"
); );
console.tag("Combo!").time().file().log("A combo"); console.tag("Combo!").time().file().log("A combo");
console.log("A string %s and a number %d", "hello", "123"); //you can you printf-like format

View file

@ -12,12 +12,24 @@ console.log(process.console); //undefined
var myConfigConsole = scribe.console({ var myConfigConsole = scribe.console({
console : { //Default options for all myConfigConsole loggers console : { //Default options for all myConfigConsole loggers
colors : ['rainbow', 'inverse', 'black'] colors : 'white',
tagsColors : 'red',
timeColors : ['grey', 'underline'],
dateColors : ['gray', 'bgMagenta'],
fileColors : 'white',
lineColors : ['yellow', 'inverse']
} }
}); });
myConfigConsole.addLogger('fun'); myConfigConsole.addLogger('fun', ['rainbow', 'inverse', 'black']);
myConfigConsole.fun('Some rainbow in background !'); myConfigConsole.fun('Some rainbow in background !');
myConfigConsole.addLogger('log');
myConfigConsole.tag('A tag', 123).log('custom tags');
myConfigConsole.time().log('custom time');
myConfigConsole.date().log('custom date');
myConfigConsole.file().log('custom file');