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:
Jakob Ackermann
2023-08-25 08:04:40 +00:00
committed by Copybot
parent 6b051b260e
commit ddf6ac272d
3 changed files with 13 additions and 11 deletions
+9
View File
@@ -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()