[node] add/fix console methods for 10.x

This commit is contained in:
Jeff Kenney
2018-12-14 22:53:24 -08:00
parent 9f88ee6e80
commit 967265a2ce
2 changed files with 82 additions and 2 deletions
+23 -2
View File
@@ -113,7 +113,7 @@ interface Console {
/**
* For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
*/
timeLog(label: string, ...data: any[]): void;
timeLog(label?: string, ...data: any[]): void;
/**
* Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
*/
@@ -124,6 +124,13 @@ interface Console {
warn(message?: any, ...optionalParams: any[]): void;
// --- Inspector mode only ---
/**
* This method does not display anything unless used in the inspector.
* The console.markTimeline() method is the deprecated form of console.timeStamp().
*
* @deprecated Use console.timeStamp() instead.
*/
markTimeline(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Starts a JavaScript CPU profile with an optional label.
@@ -133,12 +140,26 @@ interface Console {
* 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.
*/
profileEnd(): void;
profileEnd(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* Adds an event with the label `label` to the Timeline panel of the inspector.
*/
timeStamp(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* The console.timeline() method is the deprecated form of console.time().
*
* @deprecated Use console.time() instead.
*/
timeline(label?: string): void;
/**
* This method does not display anything unless used in the inspector.
* The console.timelineEnd() method is the deprecated form of console.timeEnd().
*
* @deprecated Use console.timeEnd() instead.
*/
timelineEnd(label?: string): void;
}
interface Error {
+59
View File
@@ -3369,6 +3369,65 @@ import * as p from "process";
stdout: writeStream
});
}
{
console.assert('value');
console.assert('value', 'message');
console.assert('value', 'message', 'foo', 'bar');
console.clear();
console.count();
console.count('label');
console.countReset();
console.countReset('label');
console.debug();
console.debug('message');
console.debug('message', 'foo', 'bar');
console.dir('obj');
console.dir('obj', { depth: 1 });
console.error();
console.error('message');
console.error('message', 'foo', 'bar');
console.group();
console.group('label');
console.group('label1', 'label2');
console.groupCollapsed();
console.groupEnd();
console.info();
console.info('message');
console.info('message', 'foo', 'bar');
console.log();
console.log('message');
console.log('message', 'foo', 'bar');
console.table({ foo: 'bar' });
console.table([{ foo: 'bar' }]);
console.table([{ foo: 'bar' }], ['foo']);
console.time();
console.time('label');
console.timeEnd();
console.timeEnd('label');
console.timeLog();
console.timeLog('label');
console.timeLog('label', 'foo', 'bar');
console.trace();
console.trace('message');
console.trace('message', 'foo', 'bar');
console.warn();
console.warn('message');
console.warn('message', 'foo', 'bar');
// --- Inspector mode only ---
console.markTimeline();
console.markTimeline('label');
console.profile();
console.profile('label');
console.profileEnd();
console.profileEnd('label');
console.timeStamp();
console.timeStamp('label');
console.timeline();
console.timeline('label');
console.timelineEnd();
console.timelineEnd('label');
}
}
///////////////////////////////////////////////////