mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Send errors to Sentry if configured
This commit is contained in:
@@ -6,12 +6,21 @@ module.exports = Logger =
|
||||
name: name
|
||||
serializers: bunyan.stdSerializers
|
||||
return @
|
||||
|
||||
initializeErrorReporting: (sentry_dsn) ->
|
||||
raven = require "raven"
|
||||
@raven = new raven.Client(sentry_dsn)
|
||||
|
||||
info : ()->
|
||||
@logger.info.apply(@logger, arguments)
|
||||
log : ()->
|
||||
@logger.info.apply(@logger, arguments)
|
||||
error: ()->
|
||||
@logger.error.apply(@logger, arguments)
|
||||
error: (attributes, args...)->
|
||||
@logger.error(attributes, args...)
|
||||
if @raven?
|
||||
error = attributes.err or attributes.error
|
||||
if error?
|
||||
@raven.captureError(error, attributes)
|
||||
err: ()->
|
||||
@logger.error.apply(@logger, arguments)
|
||||
warn: ()->
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
"homepage": "www.sharelatex.com",
|
||||
"description": "A centralised logging system for ShareLaTeX",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/sharelatex/logger-sharelatex.git"
|
||||
"type": "git",
|
||||
"url": "http://github.com/sharelatex/logger-sharelatex.git"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"bunyan": "1.3.6",
|
||||
"coffee-script": "1.4.0",
|
||||
"bunyan": "1.3.6"
|
||||
"raven": "^0.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user