Add some debug logging to the shared process
This commit is contained in:
parent
86c1c9993e
commit
e7d7ff3733
|
@ -246,7 +246,7 @@ export class ServerFormatter extends Formatter {
|
||||||
*/
|
*/
|
||||||
export class Logger {
|
export class Logger {
|
||||||
|
|
||||||
public level = Level.Debug;
|
public level = Level.Info;
|
||||||
|
|
||||||
private readonly nameColor?: string;
|
private readonly nameColor?: string;
|
||||||
private muted: boolean;
|
private muted: boolean;
|
||||||
|
@ -335,6 +335,7 @@ 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,20 +20,21 @@ export type SharedProcessEvent = {
|
||||||
} | {
|
} | {
|
||||||
readonly state: SharedProcessState.Stopped;
|
readonly state: SharedProcessState.Stopped;
|
||||||
readonly error: string;
|
readonly error: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class SharedProcess {
|
export class SharedProcess {
|
||||||
|
|
||||||
public readonly socketPath: string = path.join(os.tmpdir(), `.vscode-online${Math.random().toString()}`);
|
public readonly socketPath: string = path.join(os.tmpdir(), `.vscode-online${Math.random().toString()}`);
|
||||||
private _state: SharedProcessState = SharedProcessState.Stopped;
|
private _state: SharedProcessState = SharedProcessState.Stopped;
|
||||||
private activeProcess: ChildProcess | undefined;
|
private activeProcess: ChildProcess | undefined;
|
||||||
private ipcHandler: StdioIpcHandler | undefined;
|
private ipcHandler: StdioIpcHandler | undefined;
|
||||||
private readonly onStateEmitter: Emitter<SharedProcessEvent>;
|
private readonly onStateEmitter: Emitter<SharedProcessEvent>;
|
||||||
|
private readonly logger = logger.named("SHDR PROC");
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private readonly userDataDir: string,
|
private readonly userDataDir: string,
|
||||||
) {
|
) {
|
||||||
this.onStateEmitter = new Emitter();
|
this.onStateEmitter = new Emitter();
|
||||||
|
|
||||||
this.restart();
|
this.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +101,11 @@ export class SharedProcess {
|
||||||
state: SharedProcessState.Ready,
|
state: SharedProcessState.Ready,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
this.activeProcess.stdout.on("data", (data) => {
|
||||||
|
this.logger.debug("stdout", field("message", data.toString()));
|
||||||
|
});
|
||||||
this.activeProcess.stderr.on("data", (data) => {
|
this.activeProcess.stderr.on("data", (data) => {
|
||||||
|
this.logger.debug("stderr", field("message", data.toString()));
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
this.setState({
|
this.setState({
|
||||||
error: data.toString(),
|
error: data.toString(),
|
||||||
|
@ -110,8 +115,6 @@ export class SharedProcess {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.activeProcess.kill();
|
this.activeProcess.kill();
|
||||||
} else {
|
|
||||||
logger.named("SHRD PROC").debug("stderr", field("message", data.toString()));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue