MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / writeMigrationLog

Function writeMigrationLog

apps/desktop/main/utils/pathUtils.ts:184–195  ·  view source on GitHub ↗
(logDir: string, message: string, ensureDir: (dirPath: string) => void)

Source from the content-addressed store, hash-verified

182 * 写入迁移日志到 app.log
183 */
184export 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
197function hasChatLabStructure(entries: string[], markerFile: string, requiredDirs: string[]): boolean {
198 const hasMarker = entries.includes(markerFile)

Callers 4

logFunction · 0.90
migrateFromLegacyDirFunction · 0.90
migrateToUnifiedDirsFunction · 0.90

Calls 1

ensureDirFunction · 0.50

Tested by

no test coverage detected