Skip to content

Commit

Permalink
lib: move DEP0026 to end of life
Browse files Browse the repository at this point in the history
PR-URL: #25377
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
cjihrig committed Jan 10, 2019
1 parent dce2f3e commit 2d578ad
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 27 deletions.
9 changes: 5 additions & 4 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ The `sys` module is deprecated. Please use the [`util`][] module instead.
### DEP0026: util.print()
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/xxxxx
description: End-of-Life.
- version:
- v4.8.6
- v6.12.0
Expand All @@ -579,10 +582,9 @@ changes:
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

The [`util.print()`][] API is deprecated. Please use [`console.log()`][]
instead.
`util.print()` has been removed. Please use [`console.log()`][] instead.

<a id="DEP0027"></a>
### DEP0027: util.puts()
Expand Down Expand Up @@ -2411,7 +2413,6 @@ Setting the TLS ServerName to an IP address is not permitted by
[`util.isSymbol()`]: util.html#util_util_issymbol_object
[`util.isUndefined()`]: util.html#util_util_isundefined_object
[`util.log()`]: util.html#util_util_log_string
[`util.print()`]: util.html#util_util_print_strings
[`util.puts()`]: util.html#util_util_puts_strings
[`util.types`]: util.html#util_util_types
[`util`]: util.html
Expand Down
10 changes: 0 additions & 10 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -2167,16 +2167,6 @@ const util = require('util');
util.log('Timestamped message.');
```

### util.print([...strings])
<!-- YAML
added: v0.3.0
deprecated: v0.11.3
-->

> Stability: 0 - Deprecated: Use [`console.log()`][] instead.
Deprecated predecessor of `console.log`.

### util.puts([...strings])
<!-- YAML
added: v0.3.0
Expand Down
9 changes: 0 additions & 9 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ function _extend(target, source) {

// Deprecated old stuff.

function print(...args) {
for (var i = 0, len = args.length; i < len; ++i) {
process.stdout.write(String(args[i]));
}
}

function puts(...args) {
for (var i = 0, len = args.length; i < len; ++i) {
process.stdout.write(`${args[i]}\n`);
Expand Down Expand Up @@ -447,9 +441,6 @@ module.exports = exports = {
error: deprecate(error,
'util.error is deprecated. Use console.error instead.',
'DEP0029'),
print: deprecate(print,
'util.print is deprecated. Use console.log instead.',
'DEP0026'),
puts: deprecate(puts,
'util.puts is deprecated. Use console.log instead.',
'DEP0027')
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-init-index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

(function() {
require('util').print('Loaded successfully!');
process.stdout.write('Loaded successfully!');
})();

2 changes: 1 addition & 1 deletion test/fixtures/test-init-native/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(function() {
const fs = require('fs');
if (fs.readFile) {
require('util').print('fs loaded successfully');
process.stdout.write('fs loaded successfully');
}
})();

2 changes: 0 additions & 2 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,11 @@ assert.strictEqual(util.isFunction(), false);
assert.strictEqual(util.isFunction('string'), false);

common.expectWarning('DeprecationWarning', [
['util.print is deprecated. Use console.log instead.', 'DEP0026'],
['util.puts is deprecated. Use console.log instead.', 'DEP0027'],
['util.debug is deprecated. Use console.error instead.', 'DEP0028'],
['util.error is deprecated. Use console.error instead.', 'DEP0029']
]);

util.print('test');
util.puts('test');
util.debug('test');
util.error('test');
Expand Down

0 comments on commit 2d578ad

Please sign in to comment.