From e468cd3ee79e51e7306d86731106e4ac80ab2d22 Mon Sep 17 00:00:00 2001 From: Amelia Clarke Date: Sat, 25 Feb 2017 09:31:35 -0800 Subject: [PATCH] doc: argument types for console methods Refs: https://github.com/nodejs/node/issues/9399 PR-URL: https://github.com/nodejs/node/pull/11554 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- doc/api/console.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/api/console.md b/doc/api/console.md index 45566a9cdf586d..cd538d73328615 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -66,6 +66,8 @@ const Console = console.Console; ``` ### new Console(stdout[, stderr]) +* `stdout` {Writable} +* `stderr` {Writable} Creates a new `Console` by passing one or two writable stream instances. `stdout` is a writable stream to print log or info output. `stderr` @@ -94,6 +96,9 @@ new Console(process.stdout, process.stderr); +* `value` {any} +* `message` {any} +* `...args` {any} A simple assertion test that verifies whether `value` is truthy. If it is not, an `AssertionError` is thrown. If provided, the error `message` is formatted @@ -155,6 +160,11 @@ console.log('this will also print'); +* `obj` {any} +* `options` {Object} + * `showHidden` {Boolean} + * `depth` {Number} + * `colors` {Boolean} Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. This function bypasses any custom `inspect()` function defined on `obj`. An @@ -176,6 +186,8 @@ Defaults to `false`. Colors are customizable; see +* `data` {any} +* `...args` {any} Prints to `stderr` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution @@ -198,6 +210,8 @@ values are concatenated. See [`util.format()`][] for more information. +* `data` {any} +* `...args` {any} The `console.info()` function is an alias for [`console.log()`][]. @@ -205,6 +219,8 @@ The `console.info()` function is an alias for [`console.log()`][]. +* `data` {any} +* `...args` {any} Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution @@ -227,6 +243,7 @@ values are concatenated. See [`util.format()`][] for more information. +* `label` {String} Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. Use the same `label` when you call @@ -242,6 +259,7 @@ changes: description: This method no longer supports multiple calls that don’t map to individual `console.time()` calls; see below for details. --> +* `label` {String} Stops a timer that was previously started by calling [`console.time()`][] and prints the result to `stdout`: @@ -260,10 +278,12 @@ leaking it. On older versions, the timer persisted. This allowed `console.timeEnd()` to be called multiple times for the same label. This functionality was unintended and is no longer supported.* -### console.trace(message[, ...args]) +### console.trace([message][, ...args]) +* `message` {any} +* `...args` {any} Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][] formatted message and stack trace to the current position in the code. @@ -288,6 +308,8 @@ console.trace('Show me'); +* `data` {any} +* `...args` {any} The `console.warn()` function is an alias for [`console.error()`][].