Sfoglia il codice sorgente

Adds isDebugging property

main
Eric Amodio 6 anni fa
parent
commit
550fada53e
1 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. +15
    -0
      src/logger.ts

+ 15
- 0
src/logger.ts Vedi File

@ -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;
}
}

Caricamento…
Annulla
Salva