diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 4f3449467..9494b596a 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -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, }); } diff --git a/packages/server/src/vscode/sharedProcess.ts b/packages/server/src/vscode/sharedProcess.ts index 6911c6407..4f6a4c381 100644 --- a/packages/server/src/vscode/sharedProcess.ts +++ b/packages/server/src/vscode/sharedProcess.ts @@ -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; - 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);