From 9aaa8af844230fdae104d7c3a363a8572e1084cc Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 13 Jun 2021 02:32:05 -0400 Subject: [PATCH] Adds git logging to debug console --- src/logger.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/logger.ts b/src/logger.ts index fbaf603..8768180 100644 --- a/src/logger.ts +++ b/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}`); }