MCPcopy
hub / github.com/coder/mux / createInitLogger

Method createInitLogger

src/node/services/workspaceService.ts:2554–2594  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

2552 }
2553
2554 private createInitLogger(workspaceId: string) {
2555 const hasInitState = () => this.initStateManager.getInitState(workspaceId) !== undefined;
2556
2557 return {
2558 logStep: (message: string) => {
2559 if (!hasInitState()) {
2560 return;
2561 }
2562 this.initStateManager.appendOutput(workspaceId, message, false);
2563 },
2564 logStdout: (line: string) => {
2565 if (!hasInitState()) {
2566 return;
2567 }
2568 this.initStateManager.appendOutput(workspaceId, line, false);
2569 },
2570 logStderr: (line: string) => {
2571 if (!hasInitState()) {
2572 return;
2573 }
2574 this.initStateManager.appendOutput(workspaceId, line, true);
2575 },
2576 logComplete: (exitCode: number) => {
2577 this.initAbortControllers.delete(workspaceId);
2578
2579 // WorkspaceService.remove() clears in-memory init state early so waiters/tools can bail out.
2580 // If init completes after deletion, avoid noisy logs (endInit() would report missing state).
2581 if (!hasInitState()) {
2582 return;
2583 }
2584
2585 void this.initStateManager.endInit(workspaceId, exitCode);
2586 },
2587 enterHookPhase: () => {
2588 if (!hasInitState()) {
2589 return;
2590 }
2591 this.initStateManager.enterHookPhase(workspaceId);
2592 },
2593 };
2594 }
2595
2596 private schedulePostCompactionMetadataRefresh(workspaceId: string): void {
2597 assert(typeof workspaceId === "string", "workspaceId must be a string");

Callers 3

createMethod · 0.95
createMultiProjectMethod · 0.95
forkMethod · 0.95

Calls 4

appendOutputMethod · 0.80
endInitMethod · 0.80
enterHookPhaseMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected