mirror of https://github.com/Requarks/wiki.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
578 B
20 lines
578 B
'use strict'
|
|
|
|
const util = require('util')
|
|
const winston = require('winston')
|
|
|
|
let SentryLogger = winston.transports.RollbarLogger = function (options) {
|
|
this.name = 'sentryLogger'
|
|
this.level = options.level || 'warn'
|
|
this.raven = require('raven')
|
|
this.raven.config(options.key).install()
|
|
}
|
|
util.inherits(SentryLogger, winston.Transport)
|
|
|
|
SentryLogger.prototype.log = function (level, msg, meta, callback) {
|
|
level = (level === 'warn') ? 'warning' : level
|
|
this.raven.captureMessage(msg, { level, extra: meta })
|
|
callback(null, true)
|
|
}
|
|
|
|
module.exports = SentryLogger
|