Skip to content

doc: add added: information for console #6995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ new Console(process.stdout, process.stderr);
```

### console.assert(value[, message][, ...])
<!-- YAML
added: v0.1.101
-->

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 @@ -150,6 +153,9 @@ console.log('this will also print');
```

### console.dir(obj[, options])
<!-- YAML
added: v0.1.101
-->

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 @@ -168,6 +174,9 @@ Defaults to `false`. Colors are customizable; see
[customizing `util.inspect()` colors][].

### console.error([data][, ...])
<!-- YAML
added: v0.1.100
-->

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 @@ -187,10 +196,16 @@ If formatting elements (e.g. `%d`) are not found in the first string then
values are concatenated. See [`util.format()`][] for more information.

### console.info([data][, ...])
<!-- YAML
added: v0.1.100
-->

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

### console.log([data][, ...])
<!-- YAML
added: v0.1.100
-->

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 @@ -210,13 +225,19 @@ If formatting elements (e.g. `%d`) are not found in the first string then
values are concatenated. See [`util.format()`][] for more information.

### console.time(label)
<!-- YAML
added: v0.1.104
-->

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
[`console.timeEnd()`][] to stop the timer and output the elapsed time in
milliseconds to stdout. Timer durations are accurate to the sub-millisecond.

### console.timeEnd(label)
<!-- YAML
added: v0.1.104
-->

Stops a timer that was previously started by calling [`console.time()`][] and
prints the result to stdout:
Expand All @@ -236,6 +257,9 @@ leaking it. On older versions, the timer persisted. This allowed
functionality was unintended and is no longer supported.*

### console.trace(message[, ...])
<!-- YAML
added: v0.1.104
-->

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 @@ -257,6 +281,9 @@ console.trace('Show me');
```

### console.warn([data][, ...])
<!-- YAML
added: v0.1.100
-->

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

Expand Down