mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-23 19:04:14 +00:00
Merge branch 'master' into jpa-csh-tracing-end-time-from-fs
This commit is contained in:
commit
9437266dcb
5 changed files with 34 additions and 9 deletions
|
@ -1 +1,2 @@
|
|||
10.19.0
|
||||
10.21.0
|
||||
|
||||
|
|
|
@ -128,13 +128,11 @@ const Logger = (module.exports = {
|
|||
this.raven.captureException(error, { tags, extra, level })
|
||||
|
||||
// put a flag on the errors to avoid reporting them multiple times
|
||||
const result = []
|
||||
for (key in attributes) {
|
||||
value = attributes[key]
|
||||
if (value instanceof Error) {
|
||||
value.reportedToSentry = true
|
||||
}
|
||||
return result
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore Raven errors
|
||||
|
|
8
libraries/logger/package-lock.json
generated
8
libraries/logger/package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "logger-sharelatex",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -140,9 +140,9 @@
|
|||
}
|
||||
},
|
||||
"@overleaf/o-error": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-2.1.0.tgz",
|
||||
"integrity": "sha512-Zd9sks9LrLw8ErHt/cXeWIkyxWAqNAvNGn7wIjLQJH6TTEEW835PWOhpch+hQwwWsTxWIx/JDj+IpZ3ouw925g=="
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-3.0.0.tgz",
|
||||
"integrity": "sha512-LsM2s6Iy9G97ktPo0ys4VxtI/m3ahc1ZHwjo5XnhXtjeIkkkVAehsrcRRoV/yWepPjymB0oZonhcfojpjYR/tg=="
|
||||
},
|
||||
"@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"url": "http://github.com/sharelatex/logger-sharelatex.git"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"version": "1.9.0",
|
||||
"version": "2.0.0",
|
||||
"scripts": {
|
||||
"test": "mocha test/**/*.js",
|
||||
"format": "prettier-eslint '**/*.js' --list-different",
|
||||
|
@ -16,7 +16,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@google-cloud/logging-bunyan": "^2.0.0",
|
||||
"@overleaf/o-error": "^2.0.0",
|
||||
"@overleaf/o-error": "^3.0.0",
|
||||
"bunyan": "1.8.12",
|
||||
"raven": "1.1.3",
|
||||
"yn": "^3.1.1"
|
||||
|
|
|
@ -259,6 +259,32 @@ describe('LoggingManager', function() {
|
|||
this.logger.error({ foo: 'bar' }, 'message')
|
||||
this.captureException.callCount.should.equal(10)
|
||||
})
|
||||
|
||||
describe('reportedToSentry', function() {
|
||||
it('should mark the error as reported to sentry', function() {
|
||||
const err = new Error()
|
||||
this.logger.error({ err }, 'message')
|
||||
expect(this.captureException.called).to.equal(true)
|
||||
expect(err.reportedToSentry).to.equal(true)
|
||||
})
|
||||
|
||||
it('should mark two errors as reported to sentry', function() {
|
||||
const err1 = new Error()
|
||||
const err2 = new Error()
|
||||
this.logger.error({ err: err1, err2 }, 'message')
|
||||
expect(this.captureException.called).to.equal(true)
|
||||
expect(err1.reportedToSentry).to.equal(true)
|
||||
expect(err2.reportedToSentry).to.equal(true)
|
||||
})
|
||||
|
||||
it('should not mark arbitrary objects as reported to sentry', function() {
|
||||
const err = new Error()
|
||||
const ctx = { foo: 'bar' }
|
||||
this.logger.error({ err, ctx }, 'message')
|
||||
expect(this.captureException.called).to.equal(true)
|
||||
expect(ctx.reportedToSentry).to.equal(undefined)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('checkLogLevel', function() {
|
||||
|
|
Loading…
Reference in a new issue