Fix failure due to included files when using vscode's log level enum

This commit is contained in:
Asher 2019-02-07 14:17:14 -06:00
parent e4ff8e1c63
commit 73762017c8
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC
2 changed files with 10 additions and 22 deletions

View File

@ -2,10 +2,11 @@
* Log level.
*/
export enum Level {
Debug = 0,
Info = 1,
Warn = 2,
Error = 3,
Trace,
Debug,
Info,
Warning,
Error,
}
/**
@ -229,7 +230,7 @@ export class Logger {
switch (envLevel) {
case "debug": this.level = Level.Debug; break;
case "info": this.level = Level.Info; break;
case "warn": this.level = Level.Warn; break;
case "warn": this.level = Level.Warning; break;
case "error": this.level = Level.Error; break;
}
}
@ -272,7 +273,7 @@ export class Logger {
message,
fields,
tagColor: "#FF9D00",
level: Level.Warn,
level: Level.Warning,
});
}

View File

@ -5,9 +5,9 @@ import * as path from "path";
import { forkModule } from "./bootstrapFork";
import { StdioIpcHandler } from "../ipc";
import { ParsedArgs } from "vs/platform/environment/common/environment";
import { LogLevel } from "vs/platform/log/common/log";
import { Emitter } from "@coder/events/src";
import { retry } from "@coder/ide/src/retry";
import { logger, Level } from "@coder/logger";
export enum SharedProcessState {
Stopped,
@ -80,30 +80,17 @@ export class SharedProcess {
});
this.ipcHandler = new StdioIpcHandler(this.activeProcess);
this.ipcHandler.once("handshake:hello", () => {
let logLevel = LogLevel.Warning;
const envLevel = typeof global !== "undefined" && typeof global.process !== "undefined" ? global.process.env.LOG_LEVEL : process.env.LOG_LEVEL;
if (envLevel) {
switch (envLevel) {
case "trace": logLevel = LogLevel.Trace; break;
case "debug": logLevel = LogLevel.Debug; break;
case "info": logLevel = LogLevel.Info; break;
case "warn": logLevel = LogLevel.Warning; break;
case "error": logLevel = LogLevel.Error; break;
case "critical": logLevel = LogLevel.Critical; break;
case "off": logLevel = LogLevel.Off; break;
}
}
const data: {
sharedIPCHandle: string;
args: Partial<ParsedArgs>;
logLevel: LogLevel;
logLevel: Level;
} = {
args: {
"builtin-extensions-dir": this.builtInExtensionsDir,
"user-data-dir": this.userDataDir,
"extensions-dir": extensionsDir,
},
logLevel,
logLevel: logger.level,
sharedIPCHandle: this.socketPath,
};
this.ipcHandler!.send("handshake:hey there", "", data);