fix: use proper logger in ConfigManager backup/restore methods

Replace console.log/console.error with proper logger usage in
backupEnvFile and restoreBackup methods. Use the existing 'log' logger
created with createLogger('ConfigManager') following the same pattern
used in other methods.

Changes:
- Import createLogger and create log instance
- Replace console.log with log.debug in backupEnvFile
- Replace console.error with log.error in both methods
- Pass error and path metadata as objects for structured logging
- Fix test to use correct backup path (process.cwd() + src/main/.env.backup)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-03-03 14:04:42 +08:00
parent b5ef38f486
commit 7e37a9b1fc
2 changed files with 9 additions and 6 deletions

View File

@@ -78,10 +78,10 @@ describe('ConfigManager - backup and restore', () => {
expect(backupSuccess).toBe(true)
// Check backup file exists (in same location as .env file)
// Check backup file exists (in same location as .env file, which is src/main/)
const fs = await import('fs')
const path = await import('path')
const backupPath = path.resolve('src/main/.env.backup')
const backupPath = path.resolve(process.cwd(), 'src/main/.env.backup')
expect(fs.existsSync(backupPath)).toBe(true)
})