Set shared process log level

This commit is contained in:
Asher 2019-02-07 13:50:17 -06:00
parent 86d70ec790
commit e4ff8e1c63
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC
2 changed files with 18 additions and 3 deletions

View File

@ -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);

View File

@ -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<ParsedArgs>;
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);