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 <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
acc3a80546
commit
87a039d721
@ -73,6 +73,8 @@ const Console = console.Console;
|
|||||||
```
|
```
|
||||||
|
|
||||||
### new Console(stdout[, stderr])
|
### new Console(stdout[, stderr])
|
||||||
|
* `stdout` {Writable}
|
||||||
|
* `stderr` {Writable}
|
||||||
|
|
||||||
Creates a new `Console` by passing one or two writable stream instances.
|
Creates a new `Console` by passing one or two writable stream instances.
|
||||||
`stdout` is a writable stream to print log or info output. `stderr`
|
`stdout` is a writable stream to print log or info output. `stderr`
|
||||||
@ -101,6 +103,9 @@ new Console(process.stdout, process.stderr);
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.101
|
added: v0.1.101
|
||||||
-->
|
-->
|
||||||
|
* `value` {any}
|
||||||
|
* `message` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
A simple assertion test that verifies whether `value` is truthy. If it is not,
|
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
|
an `AssertionError` is thrown. If provided, the error `message` is formatted
|
||||||
@ -162,6 +167,11 @@ console.log('this will also print');
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.101
|
added: v0.1.101
|
||||||
-->
|
-->
|
||||||
|
* `obj` {any}
|
||||||
|
* `options` {Object}
|
||||||
|
* `showHidden` {Boolean}
|
||||||
|
* `depth` {Number}
|
||||||
|
* `colors` {Boolean}
|
||||||
|
|
||||||
Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`.
|
Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`.
|
||||||
This function bypasses any custom `inspect()` function defined on `obj`. An
|
This function bypasses any custom `inspect()` function defined on `obj`. An
|
||||||
@ -183,6 +193,8 @@ Defaults to `false`. Colors are customizable; see
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
* `data` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
||||||
first used as the primary message and all additional used as substitution
|
first used as the primary message and all additional used as substitution
|
||||||
@ -205,6 +217,8 @@ values are concatenated. See [`util.format()`][] for more information.
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
* `data` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
The `console.info()` function is an alias for [`console.log()`][].
|
The `console.info()` function is an alias for [`console.log()`][].
|
||||||
|
|
||||||
@ -212,6 +226,8 @@ The `console.info()` function is an alias for [`console.log()`][].
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
* `data` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
||||||
first used as the primary message and all additional used as substitution
|
first used as the primary message and all additional used as substitution
|
||||||
@ -234,6 +250,7 @@ values are concatenated. See [`util.format()`][] for more information.
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.104
|
added: v0.1.104
|
||||||
-->
|
-->
|
||||||
|
* `label` {String}
|
||||||
|
|
||||||
Starts a timer that can be used to compute the duration of an operation. Timers
|
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
|
are identified by a unique `label`. Use the same `label` when you call
|
||||||
@ -249,6 +266,7 @@ changes:
|
|||||||
description: This method no longer supports multiple calls that don’t map
|
description: This method no longer supports multiple calls that don’t map
|
||||||
to individual `console.time()` calls; see below for details.
|
to individual `console.time()` calls; see below for details.
|
||||||
-->
|
-->
|
||||||
|
* `label` {String}
|
||||||
|
|
||||||
Stops a timer that was previously started by calling [`console.time()`][] and
|
Stops a timer that was previously started by calling [`console.time()`][] and
|
||||||
prints the result to `stdout`:
|
prints the result to `stdout`:
|
||||||
@ -267,10 +285,12 @@ leaking it. On older versions, the timer persisted. This allowed
|
|||||||
`console.timeEnd()` to be called multiple times for the same label. This
|
`console.timeEnd()` to be called multiple times for the same label. This
|
||||||
functionality was unintended and is no longer supported.*
|
functionality was unintended and is no longer supported.*
|
||||||
|
|
||||||
### console.trace(message[, ...args])
|
### console.trace([message][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.104
|
added: v0.1.104
|
||||||
-->
|
-->
|
||||||
|
* `message` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][]
|
Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][]
|
||||||
formatted message and stack trace to the current position in the code.
|
formatted message and stack trace to the current position in the code.
|
||||||
@ -295,6 +315,8 @@ console.trace('Show me');
|
|||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
* `data` {any}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
The `console.warn()` function is an alias for [`console.error()`][].
|
The `console.warn()` function is an alias for [`console.error()`][].
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user