Added sentry.io logger option

pull/73/head
NGPixel 8 years ago
parent 4dd79170c5
commit d13085ac1b

@ -7,7 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Interactive setup
- Auth: GitHub and Slack authentication providers are now available
- Auth: LDAP authentication provider is now available
- Logs: Support for the logging services: Bugsnag, Loggly, Papertrail and Rollbar
- Logs: Support for the logging services: Bugsnag, Loggly, Papertrail, Rollbar and Sentry
### Changed
- Native Compilation Removal: Replaced farmhash with md5
@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Sidebar: Contents is now Page Contents
- Sidebar: Start is now Top of Page
- UI: Content headers are now showing an anchor icon instead of a #
- Dev: Replaced Gulp with Fuse-box
### Fixed
- Auth: Authentication would fail if email has uppercase chars and provider callback is in lowercase

@ -141,4 +141,5 @@ externalLogging:
loggly: false
papertrail: false
rollbar: false
sentry: false

@ -60,5 +60,13 @@ module.exports = (isDebug) => {
})
}
if (appconfig.externalLogging.sentry) {
const sentryTransport = require('./winston-transports/sentry')
winston.add(sentryTransport, {
level: 'warn',
key: appconfig.externalLogging.sentry
})
}
return winston
}

@ -0,0 +1,20 @@
'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

@ -212,8 +212,6 @@ server.on('error', (error) => {
server.on('listening', () => {
winston.info('[SERVER] HTTP/WS server started successfully! [RUNNING]')
winston.warn('Something went wrong!')
winston.error('An big error occured!')
})
// ----------------------------------------

Loading…
Cancel
Save