Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Use colors as before instead of prefixes to differentiate log sources #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jan 1, 2019
1 parent 3ef2689 commit d4e11b9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand All @@ -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[]) {
Expand Down Expand Up @@ -540,7 +539,7 @@ class GoDebugSession extends LoggingDebugSession {
private remotePathSeparator: string;
private packageInfo = new Map<string, string>();
private launchArgs: LaunchRequestArguments;

private logLevel: Logger.LogLevel = Logger.LogLevel.Error;
private readonly initdone = 'initdone·';

public constructor(debuggerLinesStartAt1: boolean, isServer: boolean = false) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d4e11b9

Please sign in to comment.