mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-05-03 04:44:43 +00:00
32 lines
578 B
JavaScript
32 lines
578 B
JavaScript
|
|
var logFactory = function( options ) {
|
||
|
|
return {
|
||
|
|
onDebug: function( x ) {
|
||
|
|
if( options.debug ) {
|
||
|
|
console.log( x.purple );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onEvent: function( x ) {
|
||
|
|
if( !options.quiet ) {
|
||
|
|
console.log( "\t" + x );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onStep: function( x ) {
|
||
|
|
if( !options.quiet ) {
|
||
|
|
console.log( x.blue );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onComplete: function( x ) {
|
||
|
|
console.log( x.green );
|
||
|
|
},
|
||
|
|
onWarning: function( x ) {
|
||
|
|
if( !options.quiet ) {
|
||
|
|
console.log( x.orange );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onError: function( x ) {
|
||
|
|
console.log( ("\t" + x).red );
|
||
|
|
}
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = logFactory;
|