Prevent deprecation warnings in production (#17457)
While in production, we use the `no-warnings` flag to prevent warnings from going to STDERR, and instead capture the warning events using our logger. Some warnings are helpful in debugging and/or identifying problems in production, like UnhandledPromiseRejection. Deprecation warnings are not an immediate problem, but an issue with upgrading to the next version of Node. These warnings will continue to be presented to developers, just not for production users. Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
a59ebd08dd
commit
49fae1d599
|
@ -1,5 +1,11 @@
|
|||
export default function (settings, logger) {
|
||||
process.on('warning', (warning) => {
|
||||
process.on('warning', warning => {
|
||||
// deprecation warnings do no reflect a current problem for
|
||||
// the user and therefor should be filtered out.
|
||||
if (warning.name === 'DeprecationWarning') {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.error(warning);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
export default function (kbnServer, server) {
|
||||
process.on('warning', (warning) => {
|
||||
// deprecation warnings do no reflect a current problem for
|
||||
// the user and therefor should be filtered out.
|
||||
if (warning.name === 'DeprecationWarning') {
|
||||
return;
|
||||
}
|
||||
|
||||
server.log(['warning', 'process'], warning);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue