UNPKG

bps.js

Version:

BPS patching utility

40 lines (32 loc) 1.47 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk); var _winston = require('winston'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var formatForLogs = _winston.format.combine(_winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), _winston.format.splat(), _winston.format.simple(), _winston.format.printf(function (info) { return [info.timestamp, '[' + info.level + ']', info.message].join('\t'); })); var formatForConsole = _winston.format.combine(_winston.format.splat(), _winston.format.simple(), _winston.format.printf(function (info) { switch (info.level) { case 'error': return _chalk2.default.red('ERROR: ' + info.message); case 'warn': return _chalk2.default.yellow('WARNING: ' + info.message); case 'debug': return _chalk2.default.blue(info.message); case 'verbose': return _chalk2.default.cyan(info.message); case 'silly': return _chalk2.default.magenta(info.message); default: return info.message; } })); exports.default = (0, _winston.createLogger)({ level: 'info', format: formatForLogs, transports: [new _winston.transports.File({ filename: 'debug.log', level: 'debug' }), new _winston.transports.File({ filename: 'error.log', level: 'error' }), new _winston.transports.Console({ format: formatForConsole })] });