kibana/src/cli_plugin/lib/log_warnings.js
Tyler Smalley 476a2fddf0 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>
2018-04-02 09:40:26 -07:00

11 lines
304 B
JavaScript

export default function (settings, logger) {
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);
});
}