Scribe.js/examples/run_with_config.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2014-10-26 12:25:22 +01:00
/* 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
2014-10-26 16:52:08 +01:00
colors : 'white',
tagsColors : 'red',
timeColors : ['grey', 'underline'],
dateColors : ['gray', 'bgMagenta'],
fileColors : 'white',
lineColors : ['yellow', 'inverse']
2014-12-19 09:20:52 +01:00
},
createBasic : false //Don't create basic loggers
2014-10-26 12:25:22 +01:00
});
2014-10-26 16:52:08 +01:00
myConfigConsole.addLogger('fun', ['rainbow', 'inverse', 'black']);
2014-10-26 12:25:22 +01:00
myConfigConsole.fun('Some rainbow in background !');
2014-10-26 16:52:08 +01:00
2015-01-13 18:03:49 +01:00
myConfigConsole.addLogger('log', null,
{
defaultTags : [{msg : 'Default tag', colors: 'cyan'}]
}
);
2014-10-26 16:52:08 +01:00
myConfigConsole.tag('A tag', 123).log('custom tags');
myConfigConsole.time().log('custom time');
myConfigConsole.date().log('custom date');
myConfigConsole.file().log('custom file');