feat: comprehensive INFO/WARN/ERROR logging across all controller modules
Add structured operational logging at INFO, WARN, and ERROR levels to every controller module. Standardize custom prefixes ([GEO], [SCHED], [SYNC]) to use [INFO/WARN/ERROR] [module] format. Fix misleveled logs (WARN->ERROR for data loss scenarios, WARN->INFO for routine operations). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -856,6 +856,7 @@ func (m *Manager) perDriveRepoStats() []DriveRepoInfo {
|
||||
}
|
||||
stats, err := m.restic.Stats(repoPath)
|
||||
if err != nil {
|
||||
m.logger.Printf("[WARN] [backup] perDriveRepoStats: failed to get stats for %s: %v", drive, err)
|
||||
continue
|
||||
}
|
||||
infos = append(infos, DriveRepoInfo{
|
||||
@@ -866,6 +867,7 @@ func (m *Manager) perDriveRepoStats() []DriveRepoInfo {
|
||||
LatestSnapshot: stats.LatestSnapshot,
|
||||
})
|
||||
}
|
||||
m.logger.Printf("[INFO] [backup] perDriveRepoStats: collected stats for %d drives", len(infos))
|
||||
return infos
|
||||
}
|
||||
|
||||
@@ -918,6 +920,7 @@ func (m *Manager) aggregateRepoStats() *RepoStats {
|
||||
if totalBytes > 0 {
|
||||
agg.TotalSize = humanizeBytes(totalBytes)
|
||||
}
|
||||
m.logger.Printf("[INFO] [backup] Aggregated repo stats: %d snapshots, total size %s", agg.SnapshotCount, agg.TotalSize)
|
||||
return agg
|
||||
}
|
||||
|
||||
@@ -932,6 +935,7 @@ func (m *Manager) listAllDumpFiles() []DumpFileInfo {
|
||||
}
|
||||
}
|
||||
}
|
||||
m.logger.Printf("[INFO] [backup] Found %d DB dump files across drives", len(allFiles))
|
||||
return allFiles
|
||||
}
|
||||
|
||||
@@ -979,7 +983,9 @@ func (m *Manager) saveSnapshotHistory() {
|
||||
}
|
||||
if err := os.Rename(tmp, m.snapshotHistoryFile); err != nil {
|
||||
m.logger.Printf("[WARN] Could not rename snapshot history file: %v", err)
|
||||
return
|
||||
}
|
||||
m.logger.Printf("[INFO] [backup] Saved snapshot history (%d entries)", len(m.snapshotHistory))
|
||||
}
|
||||
|
||||
// loadSnapshotHistoryFromFile reads the persisted snapshot history from disk.
|
||||
|
||||
Reference in New Issue
Block a user