@@ -48,7 +48,7 @@ myConsole.warn(`Danger ${name}! Danger!`);
48
48
```
49
49
50
50
While the API for the ` Console ` class is designed fundamentally around the
51
- Web browser ` console ` object, the ` Console ` is Node.js is * not* intended to
51
+ Web browser ` console ` object, the ` Console ` in Node.js is * not* intended to
52
52
duplicate the browsers functionality exactly.
53
53
54
54
## Asynchronous vs Synchronous Consoles
@@ -90,7 +90,7 @@ logger.log('count: %d', count);
90
90
```
91
91
92
92
The global ` console ` is a special ` Console ` whose output is sent to
93
- ` process.stdout ` and ` process.stderr ` . It is equivalent to calling:
93
+ [ ` process.stdout ` ] [ ] and [ ` process.stderr ` ] [ ] . It is equivalent to calling:
94
94
95
95
``` js
96
96
new Console (process .stdout , process .stderr );
@@ -99,7 +99,7 @@ new Console(process.stdout, process.stderr);
99
99
### console.assert(value[ , message] [ , ... ] )
100
100
101
101
A simple assertion test that verifies whether ` value ` is truthy. If it is not,
102
- an ` AssertionError ` is throw . If provided, the error ` message ` is formatted
102
+ an ` AssertionError ` is thrown . If provided, the error ` message ` is formatted
103
103
using [ ` util.format() ` ] [ ] and used as the error message.
104
104
105
105
``` js
@@ -111,27 +111,27 @@ console.assert(false, 'Whoops %s', 'didn\'t work');
111
111
112
112
### console.dir(obj[ , options] )
113
113
114
- Uses [ ` util.inspect() ` ] [ ] on ` obj ` and prints the resulting string to stdout.
114
+ Uses [ ` util.inspect() ` ] [ ] on ` obj ` and prints the resulting string to ` stdout ` .
115
115
This function bypasses any custom ` inspect() ` function defined on ` obj ` . An
116
- optional ` options ` object may be passed that alters certain aspects of the
116
+ optional ` options ` object may be passed to alter certain aspects of the
117
117
formatted string:
118
118
119
119
- ` showHidden ` - if ` true ` then the object's non-enumerable and symbol
120
120
properties will be shown too. Defaults to ` false ` .
121
121
122
- - ` depth ` - tells ` inspect ` how many times to recurse while formatting the
123
- object. This is useful for inspecting large complicated objects. Defaults to
124
- ` 2 ` . To make it recurse indefinitely, pass ` null ` .
122
+ - ` depth ` - tells [ ` util. inspect() ` ] [ ] how many times to recurse while
123
+ formatting the object. This is useful for inspecting large complicated objects.
124
+ Defaults to ` 2 ` . To make it recurse indefinitely, pass ` null ` .
125
125
126
126
- ` colors ` - if ` true ` , then the output will be styled with ANSI color codes.
127
127
Defaults to ` false ` . Colors are customizable; see
128
128
[ customizing ` util.inspect() ` colors] [ ] .
129
129
130
130
### console.error([ data] [ , ... ] )
131
131
132
- Prints to stderr with newline. Multiple arguments can be passed, with the first
133
- used as the primary message and all additional used as substitution
134
- values similar to ` printf() ` (the arguments are all passed to
132
+ Prints to ` stderr ` with newline. Multiple arguments can be passed, with the
133
+ first used as the primary message and all additional used as substitution
134
+ values similar to ` printf(3 ) ` (the arguments are all passed to
135
135
[ ` util.format() ` ] [ ] ).
136
136
137
137
``` js
@@ -144,17 +144,17 @@ console.error('error', code);
144
144
145
145
If formatting elements (e.g. ` %d ` ) are not found in the first string then
146
146
[ ` util.inspect() ` ] [ ] is called on each argument and the resulting string
147
- values are concatenated. See [ ` util.format() ` ] [ ] for more information.
147
+ values are concatenated. See [ ` util.format() ` ] [ ] for more information.
148
148
149
149
### console.info([ data] [ , ... ] )
150
150
151
151
The ` console.info() ` function is an alias for [ ` console.log() ` ] [ ] .
152
152
153
153
### console.log([ data] [ , ... ] )
154
154
155
- Prints to stdout with newline. Multiple arguments can be passed, with the first
156
- used as the primary message and all additional used as substitution
157
- values similar to ` printf() ` (the arguments are all passed to
155
+ Prints to ` stdout ` with newline. Multiple arguments can be passed, with the
156
+ first used as the primary message and all additional used as substitution
157
+ values similar to ` printf(3 ) ` (the arguments are all passed to
158
158
[ ` util.format() ` ] [ ] ).
159
159
160
160
``` js
@@ -167,7 +167,7 @@ console.log('count: ', count);
167
167
168
168
If formatting elements (e.g. ` %d ` ) are not found in the first string then
169
169
[ ` util.inspect() ` ] [ ] is called on each argument and the resulting string
170
- values are concatenated. See [ ` util.format() ` ] [ ] for more information.
170
+ values are concatenated. See [ ` util.format() ` ] [ ] for more information.
171
171
172
172
### console.time(label)
173
173
@@ -193,7 +193,7 @@ console.timeEnd('100-elements');
193
193
194
194
### console.trace(message[ , ...] )
195
195
196
- Prints to stderr the string ` 'Trace :' ` , followed by the [ ` util.format() ` ] [ ]
196
+ Prints to ` stderr ` the string ` 'Trace :' ` , followed by the [ ` util.format() ` ] [ ]
197
197
formatted message and stack trace to the current position in the code.
198
198
199
199
``` js
@@ -220,5 +220,8 @@ The `console.warn()` function is an alias for [`console.error()`][].
220
220
[ `console.log()` ] : #console_console_log_data
221
221
[ `console.time()` ] : #console_console_time_label
222
222
[ `console.timeEnd()` ] : #console_console_timeend_label
223
+ [ `process.stderr` ] : process.html#process_process_stderr
224
+ [ `process.stdout` ] : process.html#process_process_stdout
223
225
[ `util.format()` ] : util.html#util_util_format_format
224
226
[ `util.inspect()` ] : util.html#util_util_inspect_object_options
227
+ [ customizing `util.inspect()` colors ] : util.html#util_customizing_util_inspect_colors
0 commit comments