MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / rotateLogIfNeeded

Function rotateLogIfNeeded

src/daemon.ts:72–91  ·  view source on GitHub ↗
(logPath: string)

Source from the content-addressed store, hash-verified

70const MAX_LOG_ROTATIONS = 3;
71
72function rotateLogIfNeeded(logPath: string): void {
73 if (!existsSync(logPath)) {
74 return;
75 }
76
77 const size = statSync(logPath).size;
78 if (size < MAX_LOG_BYTES) {
79 return;
80 }
81
82 for (let index = MAX_LOG_ROTATIONS - 1; index >= 1; index -= 1) {
83 const from = `${logPath}.${index}`;
84 const to = `${logPath}.${index + 1}`;
85 if (existsSync(from)) {
86 renameSync(from, to);
87 }
88 }
89
90 renameSync(logPath, `${logPath}.1`);
91}
92
93function resolveDaemonLogPath(workspaceKey: string): string | null {
94 const override = process.env.XCODEBUILDMCP_DAEMON_LOG_PATH?.trim();

Callers 1

mainFunction · 0.85

Calls 1

existsSyncFunction · 0.85

Tested by

no test coverage detected