Skip to content

Commit

Permalink
internal/util: remove printDeprecationWarning
Browse files Browse the repository at this point in the history
Removes the internal/util printDeprecationWarning method

PR-URL: #8166
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
  • Loading branch information
jasnell committed Sep 2, 2016
1 parent b50557b commit 7b73f55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
10 changes: 0 additions & 10 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-process-no-deprecation.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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(() => {
Expand All @@ -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');
}));

0 comments on commit 7b73f55

Please sign in to comment.