diff --git a/lib/logger.js b/lib/logger.js new file mode 100644 index 00000000..565de3c0 --- /dev/null +++ b/lib/logger.js @@ -0,0 +1,21 @@ +"use strict"; +var winston = require('winston'); + +var logger = new(winston.Logger)({ + "exitOnError": true, + "transports": [ + new(winston.transports.Console)({ + "colorize": true, + "handleExceptions": true, + "timestamp": true, + }), + ] +}); + +logger.log = function () { + var args = Array.prototype.slice.call(arguments); + args.splice(1, 0, '[BB]'); + winston.Logger.prototype.log.apply(this, args); +}; + +module.exports = logger; diff --git a/package.json b/package.json index 5113845f..d16ae387 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "libxmljs": "*", "node-uuid": "*", "underscore": "1.6.x", + "winston": "^0.7.3", "xdate": "*", "z-schema": "^2.4.8" },