From ec066b266a3e0d163fa7c056f8b5f9c404aa5eda Mon Sep 17 00:00:00 2001 From: rickyes Date: Tue, 21 Apr 2020 17:51:25 +0800 Subject: [PATCH 1/3] console: Support for console constructor groupIndentation options --- doc/api/console.md | 31 +++++++--- lib/internal/console/constructor.js | 27 +++++++-- test/parallel/test-console-group.js | 88 ++++++++++++++++++++++++++++- 3 files changed, 130 insertions(+), 16 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 66fa862de88178..d3236534b486de 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -81,16 +81,19 @@ const { Console } = console; ### `new Console(options)` * `options` {Object} @@ -107,6 +110,8 @@ changes: **Default:** `'auto'`. * `inspectOptions` {Object} Specifies options that are passed along to [`util.inspect()`][]. + * `groupIndentation` {number} Set group indentation. + **Default:** `2`. Creates a new `Console` with one or two writable stream instances. `stdout` is a writable stream to print log or info output. `stderr` is used for warning or @@ -302,11 +307,16 @@ values are concatenated. See [`util.format()`][] for more information. ### `console.group([...label])` * `...label` {any} -Increases indentation of subsequent lines by two spaces. +Increases indentation of subsequent lines by spacesfor `groupIndentation` +length. If one or more `label`s are provided, those are printed first without the additional indentation. @@ -321,9 +331,14 @@ An alias for [`console.group()`][]. ### `console.groupEnd()` -Decreases indentation of subsequent lines by two spaces. +Decreases indentation of subsequent lines by spaces for `groupIndentation` +length. ### `console.info([data][, ...args])` * `...label` {any} @@ -331,10 +327,6 @@ An alias for [`console.group()`][]. ### `console.groupEnd()` Decreases indentation of subsequent lines by spaces for `groupIndentation`