diff options
author | Gus Caplan <me@gus.host> | 2018-11-12 15:52:43 -0600 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-11-14 19:44:39 -0800 |
commit | 7082c61e27142c1c4c55ab925baa8a162637b066 (patch) | |
tree | fbb3dc8b972b4676534f35e0d106982a311840c8 /doc/api/util.md | |
parent | ed15b336dcc804106e0ea0338f52d47dd2b7b0b2 (diff) | |
download | android-node-v8-7082c61e27142c1c4c55ab925baa8a162637b066.tar.gz android-node-v8-7082c61e27142c1c4c55ab925baa8a162637b066.tar.bz2 android-node-v8-7082c61e27142c1c4c55ab925baa8a162637b066.zip |
Revert "util: change util.inspect depth default"
This reverts commit ac7450a09a4c167cd43c14d7c88721d22f077529.
This fully reverts the changes to util.inspect depth.
It has caused breakage in logging to existing apps, and even
something as simple as `console.log(require)` will cause >1m freezes.
I've heard nothing but negative feedback (seriously not a single
person has expressed anything positive about this change) and
personally i find this change extremely annoying.
PR-URL: https://github.com/nodejs/node/pull/24326
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Diffstat (limited to 'doc/api/util.md')
-rw-r--r-- | doc/api/util.md | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/doc/api/util.md b/doc/api/util.md index 89cfc94da3..b687eaf362 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1,4 +1,4 @@ -# Util +# Util <!--introduced_in=v0.10.0--> @@ -421,7 +421,7 @@ changes: * `depth` {number} Specifies the number of times to recurse while formatting the `object`. This is useful for inspecting large complicated objects. To make it recurse up to the maximum call stack size pass `Infinity` or `null`. - **Default:** `20`. + **Default:** `2`. * `colors` {boolean} If `true`, the output will be styled with ANSI color codes. Colors are customizable, see [Customizing `util.inspect` colors][]. **Default:** `false`. @@ -478,23 +478,12 @@ util.inspect(new Bar()); // 'Bar {}' util.inspect(baz); // '[foo] {}' ``` -The following example limits the inspected output of the `paths` property: +The following example inspects all properties of the `util` object: ```js const util = require('util'); -console.log(util.inspect(module, { depth: 0 })); -// Instead of showing all entries in `paths` `[Array]` is used to limit the -// output for readability: - -// Module { -// id: '<repl>', -// exports: {}, -// parent: undefined, -// filename: null, -// loaded: false, -// children: [], -// paths: [Array] } +console.log(util.inspect(util, { showHidden: true, depth: null })); ``` The following example highlights the difference with the `compact` option: @@ -510,7 +499,7 @@ const o = { 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]) }; -console.log(util.inspect(o, { compact: true, breakLength: 80 })); +console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); // This will print @@ -524,7 +513,7 @@ console.log(util.inspect(o, { compact: true, breakLength: 80 })); // b: Map { 'za' => 1, 'zb' => 'test' } } // Setting `compact` to false changes the output to be more reader friendly. -console.log(util.inspect(o, { compact: false, breakLength: 80 })); +console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { // a: [ |