add logging of request parameters to sentry

This commit is contained in:
Brian Gough 2016-01-05 13:31:05 +00:00
parent fd70f23e5c
commit 2e21da050c
2 changed files with 12 additions and 2 deletions

View file

@ -19,11 +19,21 @@ module.exports = Logger =
@logger.error(attributes, args...)
if @raven?
error = attributes.err or attributes.error
req = attributes.req
if error?
tags = {}
extra = {}
for key, value of attributes
tags[key] = value if key.match(/_id/) and typeof value == 'string'
@raven.captureError(error, tags: tags, extra: attributes)
extra[key] = value
if req?
extra.req =
method: req.method
url: req.originalUrl
query: req.query
headers: req.headers
ip: req.ip
@raven.captureError(error, {tags: tags, extra: extra})
err: ()->
@logger.error.apply(@logger, arguments)
warn: ()->

View file

@ -6,7 +6,7 @@
"type": "git",
"url": "http://github.com/sharelatex/logger-sharelatex.git"
},
"version": "1.2.1",
"version": "1.3.0",
"dependencies": {
"bunyan": "1.5.1",
"coffee-script": "1.4.0",