()
| 39 | } |
| 40 | |
| 41 | async start() { |
| 42 | try { |
| 43 | await fs.access(logsDir); |
| 44 | } catch (error) { |
| 45 | await fs.mkdir(logsDir); |
| 46 | } |
| 47 | |
| 48 | await this.update(); |
| 49 | |
| 50 | this.watcher = fs.watch(logsDir, { signal: this.watcherAbortController.signal }); |
| 51 | |
| 52 | for await (const event of this.watcher) { |
| 53 | if (event.eventType === "change" && event.filename === this.mostRecentLogFileName) { |
| 54 | continue; |
| 55 | } |
| 56 | await this.update(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | stop() { |
| 61 | if (this.watcher) { |