summaryrefslogtreecommitdiff
path: root/doc/api/console.md
diff options
context:
space:
mode:
authorBenjamin Zaslavsky <benjamin.zaslavsky@gmail.com>2017-11-14 00:08:58 +0100
committerJames M Snell <jasnell@gmail.com>2017-11-22 09:12:18 -0800
commit982c67419b062412a7e8a7040cfd34239c6be7b4 (patch)
tree07547bdf03e5ecc0348bd53880d7933d6c251d3f /doc/api/console.md
parentb98027ee5f4e906c84e8d92e8d76baeefa60b8cf (diff)
downloadandroid-node-v8-982c67419b062412a7e8a7040cfd34239c6be7b4.tar.gz
android-node-v8-982c67419b062412a7e8a7040cfd34239c6be7b4.tar.bz2
android-node-v8-982c67419b062412a7e8a7040cfd34239c6be7b4.zip
doc: add description for inspector-only console methods.
Description inspired by dev tools reference and inspector err messages Added: * intro * console.debug() * console.dirxml() * console.markTimeline() * console.profile() * console.profileEnd() * console.table() * console.timeStamp() * console.timeline() * console.timelineEnd() PR-URL: https://github.com/nodejs/node/pull/17004 Fixes: https://github.com/nodejs/node/issues/16755 Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'doc/api/console.md')
-rw-r--r--doc/api/console.md99
1 files changed, 99 insertions, 0 deletions
diff --git a/doc/api/console.md b/doc/api/console.md
index 54d86cea16..ba1505ec1d 100644
--- a/doc/api/console.md
+++ b/doc/api/console.md
@@ -241,6 +241,10 @@ undefined
### console.debug(data[, ...args])
<!-- YAML
added: v8.0.0
+changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/17033
+ description: "`console.debug` is now an alias for `console.log`."
-->
* `data` {any}
* `...args` {any}
@@ -426,15 +430,110 @@ added: v0.1.100
The `console.warn()` function is an alias for [`console.error()`][].
+## Inspector only methods
+The following methods are exposed by the V8 engine in the general API but do
+not display anything unless used in conjunction with the [inspector][]
+(`--inspect` flag).
+
+### console.dirxml(object)
+<!-- YAML
+added: v8.0.0
+-->
+* `object` {string}
+
+This method does not display anything unless used in the inspector. The
+`console.dirxml()` method displays in `stdout` an XML interactive tree
+representation of the descendants of the specified `object` if possible, or the
+JavaScript representation if not. Calling `console.dirxml()` on an HTML or XML
+element is equivalent to calling `console.log()`.
+
+### console.markTimeline(label)
+<!-- YAML
+added: v8.0.0
+-->
+* `label` {string} Defaults to `'default'`.
+
+This method does not display anything unless used in the inspector. The
+`console.markTimeline()` method is the deprecated form of [`console.timeStamp()`][].
+
+### console.profile([label])
+<!-- YAML
+added: v8.0.0
+-->
+* `label` {string}
+
+This method does not display anything unless used in the inspector. The
+`console.profile()` method starts a JavaScript CPU profile with an optional
+label until [`console.profileEnd()`][] is called. The profile is then added to
+the **Profile** panel of the inspector.
+```js
+console.profile('MyLabel');
+// Some code
+console.profileEnd();
+// Adds the profile 'MyLabel' to the Profiles panel of the inspector.
+```
+
+### console.profileEnd()
+<!-- YAML
+added: v8.0.0
+-->
+
+This method does not display anything unless used in the inspector. Stops the
+current JavaScript CPU profiling session if one has been started and prints
+the report to the **Profiles** panel of the inspector. See
+[`console.profile()`][] for an example.
+
+### console.table(array[, columns])
+<!-- YAML
+added: v8.0.0
+-->
+* `array` {Array|Object}
+* `columns` {Array}
+
+This method does not display anything unless used in the inspector. Prints to
+`stdout` the array `array` formatted as a table.
+
+### console.timeStamp([label])
+<!-- YAML
+added: v8.0.0
+-->
+* `label` {string}
+
+This method does not display anything unless used in the inspector. The
+`console.timeStamp()` method adds an event with the label `label` to the
+**Timeline** panel of the inspector.
+
+### console.timeline([label])
+<!-- YAML
+added: v8.0.0
+-->
+* `label` {string} Defaults to `'default'`.
+
+This method does not display anything unless used in the inspector. The
+`console.timeline()` method is the deprecated form of [`console.time()`][].
+
+### console.timelineEnd([label])
+<!-- YAML
+added: v8.0.0
+-->
+* `label` {string} Defaults to `'default'`.
+
+This method does not display anything unless used in the inspector. The
+`console.timelineEnd()` method is the deprecated form of [`console.timeEnd()`][].
+
[`console.error()`]: #console_console_error_data_args
[`console.group()`]: #console_console_group_label
[`console.log()`]: #console_console_log_data_args
+[`console.profile()`]: #console_console_profile_label
+[`console.profileEnd()`]: #console_console_profileend
[`console.time()`]: #console_console_time_label
[`console.timeEnd()`]: #console_console_timeend_label
+[`console.timeStamp()`]: #console_console_timestamp_label
[`process.stderr`]: process.html#process_process_stderr
[`process.stdout`]: process.html#process_process_stdout
[`util.format()`]: util.html#util_util_format_format_args
[`util.inspect()`]: util.html#util_util_inspect_object_options
[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors
+[inspector]: debugger.html
[note on process I/O]: process.html#process_a_note_on_process_i_o
[web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert