Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit d3d35ec

Browse files
committed
add docs for console object
1 parent cbdd92e commit d3d35ec

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

Diff for: doc/api/_toc.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* [Synopsis](synopsis.html)
44
* [Globals](globals.html)
5+
* [STDIO](stdio.html)
56
* [Timers](timers.html)
67
* [Modules](modules.html)
78
* [C/C++ Addons](addons.html)

Diff for: doc/api/all.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
@include synopsis
33
@include globals
4+
@include stdio
45
@include timers
56
@include modules
67
@include addons

Diff for: doc/api/globals.markdown

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ scope; `var something` inside a Node module will be local to that module.
1616

1717
The process object. See the [process object](process.html#process) section.
1818

19+
### console
20+
21+
Used to print to stdout and stderr. See the [stdio](stdio.html) section.
22+
23+
1924
### require()
2025

2126
To require modules. See the [Modules](modules.html#modules) section.

Diff for: doc/api/stdio.markdown

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## console
2+
3+
Browser-like object for printing to stdout and stderr.
4+
5+
### console.log()
6+
7+
Prints to stdout with newline. This function can take multiple arguments in a
8+
`printf()`-like way. Example:
9+
10+
console.log('count: %d', count);
11+
12+
If formating elements are not found in the first string then `util.inspect`
13+
is used on each argument.
14+
15+
### console.info()
16+
17+
Same as `console.log`.
18+
19+
### console.warn()
20+
### console.error()
21+
22+
Same as `console.log` but prints to stderr.
23+
24+
### console.dir(obj)
25+
26+
Uses `util.inspect` on `obj` and prints resulting string to stderr.
27+
28+
### console.time(label)
29+
30+
Mark a time.
31+
32+
33+
### console.timeEnd(label)
34+
35+
Finish timer, record output. Example
36+
37+
console.time('100-elements');
38+
while (var i = 0; i < 100; i++) {
39+
;
40+
}
41+
console.timeEnd('100-elements');
42+
43+
44+
### console.trace()
45+
46+
Print a stack trace to stderr of the current position.
47+
48+
### console.assert()
49+
50+
Same as `assert.ok()`.
51+

0 commit comments

Comments
 (0)