Added support for 4 logging services

This commit is contained in:
NGPixel
2017-03-28 20:19:01 -04:00
parent 0cc858fb3d
commit df4da74539
15 changed files with 62172 additions and 21911 deletions

View File

@@ -0,0 +1,20 @@
'use strict'
const util = require('util')
const winston = require('winston')
const _ = require('lodash')
let RollbarLogger = winston.transports.RollbarLogger = function (options) {
this.name = 'rollbarLogger'
this.level = options.level || 'warn'
this.rollbar = require('rollbar')
this.rollbar.init(options.key)
}
util.inherits(RollbarLogger, winston.Transport)
RollbarLogger.prototype.log = function (level, msg, meta, callback) {
this.rollbar.handleErrorWithPayloadData(new Error(msg), _.assignIn(meta, { level }))
callback(null, true)
}
module.exports = RollbarLogger