Skip to content

Commit

Permalink
doc: argument types for console methods
Browse files Browse the repository at this point in the history
Refs: #9399
PR-URL: #11554
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
ameliavoncat authored and addaleax committed Mar 5, 2017
1 parent 5963566 commit e468cd3
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -94,6 +96,9 @@ new Console(process.stdout, process.stderr);
<!-- YAML
added: v0.1.101
-->
* `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
Expand Down Expand Up @@ -155,6 +160,11 @@ console.log('this will also print');
<!-- YAML
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`.
This function bypasses any custom `inspect()` function defined on `obj`. An
Expand All @@ -176,6 +186,8 @@ Defaults to `false`. Colors are customizable; see
<!-- YAML
added: v0.1.100
-->
* `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
Expand All @@ -198,13 +210,17 @@ values are concatenated. See [`util.format()`][] for more information.
<!-- YAML
added: v0.1.100
-->
* `data` {any}
* `...args` {any}

The `console.info()` function is an alias for [`console.log()`][].

### console.log([data][, ...args])
<!-- YAML
added: v0.1.100
-->
* `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
Expand All @@ -227,6 +243,7 @@ values are concatenated. See [`util.format()`][] for more information.
<!-- YAML
added: v0.1.104
-->
* `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
Expand All @@ -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`:
Expand All @@ -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])
<!-- YAML
added: v0.1.104
-->
* `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.
Expand All @@ -288,6 +308,8 @@ console.trace('Show me');
<!-- YAML
added: v0.1.100
-->
* `data` {any}
* `...args` {any}

The `console.warn()` function is an alias for [`console.error()`][].

Expand Down

0 comments on commit e468cd3

Please sign in to comment.