瀏覽代碼

Adds git logging to debug console

main
Eric Amodio 3 年之前
父節點
當前提交
9aaa8af844
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. +13
    -2
      src/logger.ts

+ 13
- 2
src/logger.ts 查看文件

@ -5,7 +5,10 @@ import { getCorrelationContext, getNextCorrelationId } from './system';
const emptyStr = '';
const extensionOutputChannelName = 'GitLens';
const ConsolePrefix = `[${extensionOutputChannelName}]`;
const ConsolePrefix = '[GitLens]';
const extensionGitOutputChannelName = 'GitLens (Git)';
const GitConsolePrefix = '[GitLens (Git)]';
export { TraceLevel } from './configuration';
@ -270,8 +273,16 @@ export class Logger {
static logGitCommand(command: string, ex?: Error): void {
if (this.level !== TraceLevel.Debug) return;
if (Logger.isDebugging) {
if (ex != null) {
console.error(this.timestamp, GitConsolePrefix, command ?? emptyStr, ex);
} else {
console.log(this.timestamp, GitConsolePrefix, command ?? emptyStr);
}
}
if (this.gitOutput == null) {
this.gitOutput = window.createOutputChannel(`${extensionOutputChannelName} (Git)`);
this.gitOutput = window.createOutputChannel(extensionGitOutputChannelName);
}
this.gitOutput.appendLine(`${this.timestamp} ${command}${ex != null ? `\n\n${ex.toString()}` : emptyStr}`);
}

Loading…
取消
儲存