From d4e11b9c73335e12594a593435a1d2859f9e14c0 Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 31 Dec 2018 17:41:32 -0800 Subject: [PATCH] Use colors as before instead of prefixes to differentiate log sources #858 --- src/debugAdapter/goDebug.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index b576ad9ab..694c5536a 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -220,7 +220,6 @@ process.on('uncaughtException', (err: any) => { }); function logArgsToString(args: any[]): string { - args.splice(0, 0, 'Go Debug Adapter:'); return args.map(arg => { return typeof arg === 'string' ? arg : @@ -229,7 +228,7 @@ function logArgsToString(args: any[]): string { } function log(...args: any[]) { - logger.log(logArgsToString(args)); + logger.warn(logArgsToString(args)); } function logError(...args: any[]) { @@ -540,7 +539,7 @@ class GoDebugSession extends LoggingDebugSession { private remotePathSeparator: string; private packageInfo = new Map(); private launchArgs: LaunchRequestArguments; - + private logLevel: Logger.LogLevel = Logger.LogLevel.Error; private readonly initdone = 'initdoneĀ·'; public constructor(debuggerLinesStartAt1: boolean, isServer: boolean = false) { @@ -568,12 +567,12 @@ class GoDebugSession extends LoggingDebugSession { protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { this.launchArgs = args; - const logLevel = args.trace === 'verbose' ? + this.logLevel = args.trace === 'verbose' ? Logger.LogLevel.Verbose : args.trace === 'log' ? Logger.LogLevel.Log : Logger.LogLevel.Error; - const logPath = logLevel !== Logger.LogLevel.Error ? path.join(os.tmpdir(), 'vscode-go-debug.txt') : undefined; - logger.setup(logLevel, logPath); + const logPath = this.logLevel !== Logger.LogLevel.Error ? path.join(os.tmpdir(), 'vscode-go-debug.txt') : undefined; + logger.setup(this.logLevel, logPath); if (!args.program) { this.sendErrorResponse(response, 3000, 'Failed to continue: The program attribute is missing in the debug configuration in launch.json'); @@ -605,10 +604,10 @@ class GoDebugSession extends LoggingDebugSession { this.delve = new Delve(remotePath, port, host, localPath, args); this.delve.onstdout = (str: string) => { - this.sendEvent(new OutputEvent('Delve: ' + str, 'stdout')); + this.sendEvent(new OutputEvent(str, 'stdout')); }; this.delve.onstderr = (str: string) => { - this.sendEvent(new OutputEvent('Delve: ' + str, 'stderr')); + this.sendEvent(new OutputEvent(str, 'stderr')); }; this.delve.onclose = (code) => { if (code !== 0) {