mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #14292 from overleaf/jpa-em-mj-warnings
[logger] forward warnings to logger for all the services GitOrigin-RevId: f9d0b8c7197e3e14e8abf6bba10136ee785410ed
This commit is contained in:
parent
6b051b260e
commit
ddf6ac272d
3 changed files with 13 additions and 11 deletions
|
@ -149,4 +149,13 @@ const LoggingManager = {
|
|||
|
||||
LoggingManager.initialize('default-sharelatex')
|
||||
|
||||
function handleWarning(err) {
|
||||
LoggingManager.warn({ err }, 'Warning details')
|
||||
}
|
||||
|
||||
process.on('warning', handleWarning)
|
||||
LoggingManager.removeWarningHandler = () => {
|
||||
process.off('warning', handleWarning)
|
||||
}
|
||||
|
||||
module.exports = LoggingManager
|
||||
|
|
|
@ -59,6 +59,10 @@ describe('LoggingManager', function () {
|
|||
this.logger.initializeErrorReporting('test_dsn')
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
this.LoggingManager.removeWarningHandler()
|
||||
})
|
||||
|
||||
describe('initialize', function () {
|
||||
beforeEach(function () {
|
||||
this.Bunyan.createLogger.reset()
|
||||
|
|
|
@ -19,17 +19,6 @@ Events.setMaxListeners(20)
|
|||
|
||||
const app = express()
|
||||
|
||||
process.on('warning', warning => {
|
||||
logger.warn(
|
||||
{
|
||||
name: warning.name,
|
||||
message: warning.message,
|
||||
stack: warning.stack,
|
||||
},
|
||||
'Warning details'
|
||||
)
|
||||
})
|
||||
|
||||
app.use(RequestLogger.middleware)
|
||||
|
||||
if (settings.sentry && settings.sentry.dsn) {
|
||||
|
|
Loading…
Reference in a new issue