(logDir: string, message: string, ensureDir: (dirPath: string) => void)
| 182 | * 写入迁移日志到 app.log |
| 183 | */ |
| 184 | export function writeMigrationLog(logDir: string, message: string, ensureDir: (dirPath: string) => void): void { |
| 185 | try { |
| 186 | ensureDir(logDir) |
| 187 | const logPath = path.join(logDir, 'app.log') |
| 188 | const now = new Date() |
| 189 | const timestamp = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` |
| 190 | const logLine = `[${timestamp}] [MIGRATION] ${message}\n` |
| 191 | fs.appendFileSync(logPath, logLine, 'utf-8') |
| 192 | } catch { |
| 193 | // 日志写入失败时静默处理 |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | function hasChatLabStructure(entries: string[], markerFile: string, requiredDirs: string[]): boolean { |
| 198 | const hasMarker = entries.includes(markerFile) |
no test coverage detected