mirror of
https://github.com/danog/code-server.git
synced 2024-11-30 04:39:46 +01:00
Propagate log level to client
This commit is contained in:
parent
777f460957
commit
cba8196c19
@ -260,6 +260,15 @@ export class Logger {
|
|||||||
if (name) {
|
if (name) {
|
||||||
this.nameColor = hashStringToColor(name);
|
this.nameColor = hashStringToColor(name);
|
||||||
}
|
}
|
||||||
|
this.info(`Log level: ${process.env.LOG_LEVEL || "info"}`);
|
||||||
|
if (process.env.LOG_LEVEL) {
|
||||||
|
switch (process.env.LOG_LEVEL) {
|
||||||
|
case "debug": this.level = Level.Debug; break;
|
||||||
|
case "info": this.level = Level.Info; break;
|
||||||
|
case "warn": this.level = Level.Warn; break;
|
||||||
|
case "error": this.level = Level.Error; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public set formatter(formatter: Formatter) {
|
public set formatter(formatter: Formatter) {
|
||||||
@ -335,7 +344,6 @@ export class Logger {
|
|||||||
*/
|
*/
|
||||||
public named(name: string, ...fields: FieldArray): Logger {
|
public named(name: string, ...fields: FieldArray): Logger {
|
||||||
const l = new Logger(this._formatter, name, fields);
|
const l = new Logger(this._formatter, name, fields);
|
||||||
l.level = this.level;
|
|
||||||
if (this.muted) {
|
if (this.muted) {
|
||||||
l.mute();
|
l.mute();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ export class Entry extends Command {
|
|||||||
host: flags.string({ char: "h", default: "0.0.0.0" }),
|
host: flags.string({ char: "h", default: "0.0.0.0" }),
|
||||||
open: flags.boolean({ char: "o", description: "Open in browser on startup" }),
|
open: flags.boolean({ char: "o", description: "Open in browser on startup" }),
|
||||||
port: flags.integer({ char: "p", default: 8080, description: "Port to bind on" }),
|
port: flags.integer({ char: "p", default: 8080, description: "Port to bind on" }),
|
||||||
logLevel: flags.enum({ char: "l", options: [ "debug", "info", "warn", "error" ]}),
|
|
||||||
version: flags.version({ char: "v" }),
|
version: flags.version({ char: "v" }),
|
||||||
|
|
||||||
// Dev flags
|
// Dev flags
|
||||||
@ -51,15 +50,6 @@ export class Entry extends Command {
|
|||||||
|
|
||||||
const { args, flags } = this.parse(Entry);
|
const { args, flags } = this.parse(Entry);
|
||||||
|
|
||||||
if (flags.logLevel) {
|
|
||||||
switch (flags.logLevel) {
|
|
||||||
case "debug": logger.level = Level.Debug; break;
|
|
||||||
case "info": logger.level = Level.Info; break;
|
|
||||||
case "warn": logger.level = Level.Warn; break;
|
|
||||||
case "error": logger.level = Level.Error; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags["bootstrap-fork"]) {
|
if (flags["bootstrap-fork"]) {
|
||||||
const modulePath = flags["bootstrap-fork"];
|
const modulePath = flags["bootstrap-fork"];
|
||||||
if (!modulePath) {
|
if (!modulePath) {
|
||||||
|
@ -86,6 +86,7 @@ module.exports = (options = {}) => ({
|
|||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
"process.env.NODE_ENV": `"${environment}"`,
|
"process.env.NODE_ENV": `"${environment}"`,
|
||||||
|
"process.env.LOG_LEVEL": `"${process.env.LOG_LEVEL || ""}"`,
|
||||||
}),
|
}),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "[name].css",
|
filename: "[name].css",
|
||||||
|
Loading…
Reference in New Issue
Block a user