{ "source": "doc/api/stdio.markdown", "globals": [ { "textRaw": "console", "name": "console", "stability": 4, "stabilityText": "API Frozen", "type": "global", "desc": "

For printing to stdout and stderr. Similar to the console object functions\nprovided by most web browsers, here the output is sent to stdout or stderr.\n\n

\n", "methods": [ { "textRaw": "console.log([data], [...])", "type": "method", "name": "log", "desc": "

Prints to stdout with newline. This function can take multiple arguments in a\nprintf()-like way. Example:\n\n

\n
console.log('count: %d', count);
\n

If formatting elements are not found in the first string then util.inspect\nis used on each argument. See [util.format()][] for more information.\n\n

\n", "signatures": [ { "params": [ { "name": "data", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "console.info([data], [...])", "type": "method", "name": "info", "desc": "

Same as console.log.\n\n

\n", "signatures": [ { "params": [ { "name": "data", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "console.error([data], [...])", "type": "method", "name": "error", "desc": "

Same as console.log but prints to stderr.\n\n

\n", "signatures": [ { "params": [ { "name": "data", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "console.warn([data], [...])", "type": "method", "name": "warn", "desc": "

Same as console.error.\n\n

\n", "signatures": [ { "params": [ { "name": "data", "optional": true }, { "name": "...", "optional": true } ] } ] }, { "textRaw": "console.dir(obj)", "type": "method", "name": "dir", "desc": "

Uses util.inspect on obj and prints resulting string to stdout.\n\n

\n", "signatures": [ { "params": [ { "name": "obj" } ] } ] }, { "textRaw": "console.time(label)", "type": "method", "name": "time", "desc": "

Mark a time.\n\n

\n", "signatures": [ { "params": [ { "name": "label" } ] } ] }, { "textRaw": "console.timeEnd(label)", "type": "method", "name": "timeEnd", "desc": "

Finish timer, record output. Example:\n\n

\n
console.time('100-elements');\nfor (var i = 0; i < 100; i++) {\n  ;\n}\nconsole.timeEnd('100-elements');
\n", "signatures": [ { "params": [ { "name": "label" } ] } ] }, { "textRaw": "console.trace(label)", "type": "method", "name": "trace", "desc": "

Print a stack trace to stderr of the current position.\n\n

\n", "signatures": [ { "params": [ { "name": "label" } ] } ] }, { "textRaw": "console.assert(expression, [message])", "type": "method", "name": "assert", "desc": "

Same as [assert.ok()][] where if the expression evaluates as false throw an\nAssertionError with message.\n\n

\n", "signatures": [ { "params": [ { "name": "expression" }, { "name": "message", "optional": true } ] } ] } ] } ] }