mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
util: prepend '(node) ' to deprecation messages
Changes included in this commit are
1. Making the deprecation messages consistent. The messages will be in
the following format
x is deprecated. Use y instead.
If there is no alternative for `x`, then the ` Use y instead.` part
will not be there in the message.
2. All the internal deprecation messages are printed with the prefix
`(node) `, except when the `--trace-deprecation` flag is set.
Fixes: https://github.com/nodejs/io.js/issues/1883
PR-URL: https://github.com/nodejs/io.js/pull/1892
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
committed by
Roman Reiss
parent
d55a778bae
commit
9cd44bb2b6
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
const internalUtil = require('internal/util');
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
|
||||
|
||||
@@ -91,9 +92,8 @@ Client.prototype.request = function(method, path, headers) {
|
||||
return c;
|
||||
};
|
||||
|
||||
exports.Client = util.deprecate(Client,
|
||||
'http.Client will be removed soon. Do not use it.');
|
||||
exports.Client = internalUtil.deprecate(Client, 'http.Client is deprecated.');
|
||||
|
||||
exports.createClient = util.deprecate(function(port, host) {
|
||||
exports.createClient = internalUtil.deprecate(function(port, host) {
|
||||
return new Client(port, host);
|
||||
}, 'http.createClient is deprecated. Use `http.request` instead.');
|
||||
}, 'http.createClient is deprecated. Use http.request instead.');
|
||||
|
||||
Reference in New Issue
Block a user