From d288a52a9fabe4ef64b8ee5c321f9b316e03aff9 Mon Sep 17 00:00:00 2001 From: rickyes Date: Tue, 21 Apr 2020 17:51:25 +0800 Subject: [PATCH] console: support console constructor groupIndentation option PR-URL: https://github.com/nodejs/node/pull/32964 Fixes: https://github.com/nodejs/node/issues/32947 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- doc/api/console.md | 23 +++++--- lib/internal/console/constructor.js | 28 +++++++-- test/parallel/test-console-group.js | 88 ++++++++++++++++++++++++++++- 3 files changed, 123 insertions(+), 16 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 66fa862de88178..9122b85efaa77b 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 @@ -306,7 +311,8 @@ added: v8.5.0 * `...label` {any} -Increases indentation of subsequent lines by two spaces. +Increases indentation of subsequent lines by spaces for `groupIndentation` +length. If one or more `label`s are provided, those are printed first without the additional indentation. @@ -323,7 +329,8 @@ An alias for [`console.group()`][]. added: v8.5.0 --> -Decreases indentation of subsequent lines by two spaces. +Decreases indentation of subsequent lines by spaces for `groupIndentation` +length. ### `console.info([data][, ...args])`