From e4ff8e1c635f4e9d4788e19bbb6da9522c6d5bf4 Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 7 Feb 2019 13:50:17 -0600 Subject: [PATCH] Set shared process log level --- packages/server/src/cli.ts | 2 ++ packages/server/src/vscode/sharedProcess.ts | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/server/src/cli.ts b/packages/server/src/cli.ts index dfbdc61a6..9be223ad4 100644 --- a/packages/server/src/cli.ts +++ b/packages/server/src/cli.ts @@ -115,6 +115,8 @@ export class Entry extends Command { next(); }); + // If we're not running from the binary and we aren't serving the static + // pre-built version, use webpack to serve the web files. if (!isCli && !serveStatic) { const webpackConfig = require(path.join(__dirname, "..", "..", "web", "webpack.config.js")); const compiler = require("webpack")(webpackConfig); diff --git a/packages/server/src/vscode/sharedProcess.ts b/packages/server/src/vscode/sharedProcess.ts index 49d847b5d..6911c6407 100644 --- a/packages/server/src/vscode/sharedProcess.ts +++ b/packages/server/src/vscode/sharedProcess.ts @@ -80,17 +80,30 @@ 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: ParsedArgs; + args: Partial; logLevel: LogLevel; } = { args: { "builtin-extensions-dir": this.builtInExtensionsDir, "user-data-dir": this.userDataDir, "extensions-dir": extensionsDir, - } as any, - logLevel: 0, + }, + logLevel, sharedIPCHandle: this.socketPath, }; this.ipcHandler!.send("handshake:hey there", "", data);