mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
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
f659d5c3f1
commit
476a2fddf0
2 changed files with 13 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue