瀏覽代碼

Adds isDebugging property

main
Eric Amodio 6 年之前
父節點
當前提交
550fada53e
共有 1 個檔案被更改,包括 15 行新增0 行删除
  1. +15
    -0
      src/logger.ts

+ 15
- 0
src/logger.ts 查看文件

@ -6,6 +6,8 @@ import { ExtensionOutputChannelName } from './constants';
const ConsolePrefix = `[${ExtensionOutputChannelName}]`;
const isDebuggingRegex = /^--inspect(-brk)?=?/;
export class Logger {
static debug = false;
@ -88,4 +90,17 @@ export class Logger {
}
this.gitOutput.appendLine(`${this.timestamp} ${command} (${cwd})${ex === undefined ? '' : `\n\n${ex.toString()}`}`);
}
private static _isDebugging: boolean | undefined;
static get isDebugging() {
if (this._isDebugging === undefined) {
const args = process.execArgv;
this._isDebugging = args
? args.some(arg => isDebuggingRegex.test(arg))
: false;
}
return this._isDebugging;
}
}

Loading…
取消
儲存