Browse Source

Adds git logging to debug console

main
Eric Amodio 3 years ago
parent
commit
9aaa8af844
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      src/logger.ts

+ 13
- 2
src/logger.ts View File

@ -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…
Cancel
Save