mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Revert "ignore diagnostic-channel-publishers in console.log"
to fix vscode-extension-telemetry/issues/12 the right way
This reverts commit a9b44c2065
.
This commit is contained in:
parent
d569aba4d7
commit
e67ecf1770
|
@ -69,7 +69,7 @@ export function getFirstFrame(arg0: IRemoteConsoleLog | string): IStackFrame {
|
|||
// at e.$executeContributedCommand(c:\Users\someone\Desktop\end-js\extension.js:19:17)
|
||||
const stack = arg0;
|
||||
if (stack) {
|
||||
const topFrame = findFirstFrame(stack);
|
||||
const topFrame = stack.split('\n')[0];
|
||||
|
||||
// at [^\/]* => line starts with "at" followed by any character except '/' (to not capture unix paths too late)
|
||||
// (?:(?:[a-zA-Z]+:)|(?:[\/])|(?:\\\\) => windows drive letter OR unix root OR unc root
|
||||
|
@ -88,37 +88,12 @@ export function getFirstFrame(arg0: IRemoteConsoleLog | string): IStackFrame {
|
|||
return void 0;
|
||||
}
|
||||
|
||||
const IGNORED_FRAMES = [
|
||||
|
||||
// this module patches console.log aggressively, (e.g. at Console.originalConsole.(anonymous function)
|
||||
// [as log] (/Users/bpasero/Development/Microsoft/monaco/extensions/git/node_modules/diagnostic-channel-publishers/dist/src/console.pub.js:42:39))
|
||||
'diagnostic-channel-publishers'
|
||||
];
|
||||
|
||||
function findFirstFrame(stack: string): string {
|
||||
if (!stack) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
let newlineIndex = stack.indexOf('\n');
|
||||
if (newlineIndex === -1) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
let candidate = stack.substring(0, newlineIndex);
|
||||
if (IGNORED_FRAMES.some(frame => candidate.indexOf(frame) >= 0)) {
|
||||
return findFirstFrame(stack.substr(newlineIndex + 1));
|
||||
}
|
||||
|
||||
return candidate;
|
||||
}
|
||||
|
||||
export function log(entry: IRemoteConsoleLog, label: string): void {
|
||||
const { args, stack } = parse(entry);
|
||||
|
||||
const isOneStringArg = typeof args[0] === 'string' && args.length === 1;
|
||||
|
||||
let topFrame = findFirstFrame(stack);
|
||||
let topFrame = stack && stack.split('\n')[0];
|
||||
if (topFrame) {
|
||||
topFrame = `(${topFrame.trim()})`;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue