From b016745e489afb6ac1eb0f14afdf56aeec36469e Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Wed, 13 Jun 2018 15:30:21 +0200 Subject: console: implement timeLog method Refs: https://github.com/whatwg/console/pull/138 PR-URL: https://github.com/nodejs/node/pull/21312 Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: Anatoli Papirovski Reviewed-By: Weijia Wang Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- doc/api/console.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc/api/console.md') diff --git a/doc/api/console.md b/doc/api/console.md index 6c63a4ffb5..95801c31fe 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -413,6 +413,25 @@ console.timeEnd('100-elements'); // prints 100-elements: 225.438ms ``` +### console.timeLog([label][, ...data]) + +* `label` {string} **Default:** `'default'` +* `...data` {any} + +For a timer that was previously started by calling [`console.time()`][], prints +the elapsed time and other `data` arguments to `stdout`: + +```js +console.time('process'); +const value = expensiveProcess1(); // Returns 42 +console.timeLog('process', value); +// Prints "process: 365.227ms 42". +doExpensiveProcess2(value); +console.timeEnd('process'); +``` + ### console.trace([message][, ...args])