MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / findHighestLogNumber

Function findHighestLogNumber

emain/emain-log.ts:12–28  ·  view source on GitHub ↗
(logsDir: string)

Source from the content-addressed store, hash-verified

10const oldConsoleLog = console.log;
11
12function findHighestLogNumber(logsDir: string): number {
13 if (!fs.existsSync(logsDir)) {
14 return 0;
15 }
16 const files = fs.readdirSync(logsDir);
17 let maxNum = 0;
18 for (const file of files) {
19 const match = file.match(/^waveapp\.(\d+)\.log$/);
20 if (match) {
21 const num = parseInt(match[1], 10);
22 if (num > maxNum) {
23 maxNum = num;
24 }
25 }
26 }
27 return maxNum;
28}
29
30function pruneOldLogs(logsDir: string): { pruned: string[]; error: any } {
31 if (!fs.existsSync(logsDir)) {

Callers 1

rotateLogIfNeededFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected