internal/util: remove printDeprecationWarning
Removes the internal/util printDeprecationWarning method PR-URL: https://github.com/nodejs/node/pull/8166 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
parent
b50557b51b
commit
7b73f55902
@ -19,16 +19,6 @@ exports.deprecate = function(fn, msg) {
|
||||
return exports._deprecate(fn, msg);
|
||||
};
|
||||
|
||||
// All the internal deprecations have to use this function only, as this will
|
||||
// prepend the prefix to the actual message.
|
||||
exports.printDeprecationMessage = function(msg, warned, ctor) {
|
||||
if (warned || process.noDeprecation)
|
||||
return true;
|
||||
process.emitWarning(msg, 'DeprecationWarning',
|
||||
ctor || exports.printDeprecationMessage);
|
||||
return true;
|
||||
};
|
||||
|
||||
exports.error = function(msg) {
|
||||
const fmt = `${prefix}${msg}`;
|
||||
if (arguments.length > 1) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
// Flags: --expose_internals --no-warnings
|
||||
// Flags: --no-warnings
|
||||
|
||||
// The --no-warnings flag only supresses writing the warning to stderr, not the
|
||||
// emission of the corresponding event. This test file can be run without it.
|
||||
@ -15,8 +15,7 @@ function listener() {
|
||||
|
||||
process.addListener('warning', listener);
|
||||
|
||||
const internalUtil = require('internal/util');
|
||||
internalUtil.printDeprecationMessage('Something is deprecated.');
|
||||
process.emitWarning('Something is deprecated.', 'DeprecationWarning');
|
||||
|
||||
// The warning would be emitted in the next tick, so continue after that.
|
||||
process.nextTick(common.mustCall(() => {
|
||||
@ -29,5 +28,5 @@ process.nextTick(common.mustCall(() => {
|
||||
assert.strictEqual(warning.message, 'Something else is deprecated.');
|
||||
}));
|
||||
|
||||
internalUtil.printDeprecationMessage('Something else is deprecated.');
|
||||
process.emitWarning('Something else is deprecated.', 'DeprecationWarning');
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user