Skip to content

Commit e7d7ff3

Browse files
code-asherkylecarbs
authored andcommitted
Add some debug logging to the shared process
1 parent 86c1c99 commit e7d7ff3

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/logger/src/logger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class ServerFormatter extends Formatter {
246246
*/
247247
export class Logger {
248248

249-
public level = Level.Debug;
249+
public level = Level.Info;
250250

251251
private readonly nameColor?: string;
252252
private muted: boolean;
@@ -335,6 +335,7 @@ export class Logger {
335335
*/
336336
public named(name: string, ...fields: FieldArray): Logger {
337337
const l = new Logger(this._formatter, name, fields);
338+
l.level = this.level;
338339
if (this.muted) {
339340
l.mute();
340341
}

packages/server/src/vscode/sharedProcess.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ export type SharedProcessEvent = {
2020
} | {
2121
readonly state: SharedProcessState.Stopped;
2222
readonly error: string;
23-
}
23+
};
2424

2525
export class SharedProcess {
26+
2627
public readonly socketPath: string = path.join(os.tmpdir(), `.vscode-online${Math.random().toString()}`);
2728
private _state: SharedProcessState = SharedProcessState.Stopped;
2829
private activeProcess: ChildProcess | undefined;
2930
private ipcHandler: StdioIpcHandler | undefined;
3031
private readonly onStateEmitter: Emitter<SharedProcessEvent>;
32+
private readonly logger = logger.named("SHDR PROC");
3133

3234
public constructor(
3335
private readonly userDataDir: string,
3436
) {
3537
this.onStateEmitter = new Emitter();
36-
3738
this.restart();
3839
}
3940

@@ -100,7 +101,11 @@ export class SharedProcess {
100101
state: SharedProcessState.Ready,
101102
});
102103
});
104+
this.activeProcess.stdout.on("data", (data) => {
105+
this.logger.debug("stdout", field("message", data.toString()));
106+
});
103107
this.activeProcess.stderr.on("data", (data) => {
108+
this.logger.debug("stderr", field("message", data.toString()));
104109
if (!resolved) {
105110
this.setState({
106111
error: data.toString(),
@@ -110,8 +115,6 @@ export class SharedProcess {
110115
return;
111116
}
112117
this.activeProcess.kill();
113-
} else {
114-
logger.named("SHRD PROC").debug("stderr", field("message", data.toString()));
115118
}
116119
});
117120
}

0 commit comments

Comments
 (0)