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:
@@ -5,6 +5,7 @@ package system
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -150,6 +151,7 @@ func CheckBackupDestination(path string) DestinationHealth {
|
||||
h.Warning = "A cél tárhely (" + path + ") nem létezik!"
|
||||
h.Blocked = true
|
||||
h.Severity = "critical"
|
||||
log.Printf("[WARN] [system] Backup destination %s is not safe: path does not exist", path)
|
||||
debugf("[DEBUG] [system] CheckBackupDestination: path=%q — tier1 FAIL (not exists)", path)
|
||||
return h
|
||||
}
|
||||
@@ -160,6 +162,7 @@ func CheckBackupDestination(path string) DestinationHealth {
|
||||
h.Warning = "A cél tárhely (" + path + ") nem írható! Ellenőrizd a jogosultságokat."
|
||||
h.Blocked = true
|
||||
h.Severity = "critical"
|
||||
log.Printf("[WARN] [system] Backup destination %s is not safe: not writable", path)
|
||||
debugf("[DEBUG] [system] CheckBackupDestination: path=%q — tier2 FAIL (not writable)", path)
|
||||
return h
|
||||
}
|
||||
@@ -191,10 +194,12 @@ func CheckBackupDestination(path string) DestinationHealth {
|
||||
h.Warning = fmt.Sprintf("A rendszermeghajtón csak %.1f GB szabad — legalább 10 GB szükséges a rendszer stabilitásához!", di.AvailGB)
|
||||
h.Blocked = true
|
||||
h.Severity = "critical"
|
||||
log.Printf("[WARN] [system] Backup destination %s is not safe: system drive low space (%.1f GB free)", path, di.AvailGB)
|
||||
} else if di.UsedPercent >= 90 {
|
||||
h.Warning = fmt.Sprintf("A rendszermeghajtó %.0f%%-ban megtelt — maximum 90%% megengedett.", di.UsedPercent)
|
||||
h.Blocked = true
|
||||
h.Severity = "critical"
|
||||
log.Printf("[WARN] [system] Backup destination %s is not safe: system drive %.0f%% full", path, di.UsedPercent)
|
||||
}
|
||||
// If neither triggers, keep the Tier 3 system-drive warning
|
||||
} else {
|
||||
@@ -203,6 +208,7 @@ func CheckBackupDestination(path string) DestinationHealth {
|
||||
h.Warning = fmt.Sprintf("A mentési meghajtó megtelt (%.0f%% használt)!", di.UsedPercent)
|
||||
h.Blocked = true
|
||||
h.Severity = "critical"
|
||||
log.Printf("[WARN] [system] Backup destination %s is not safe: drive %.0f%% full", path, di.UsedPercent)
|
||||
} else if di.UsedPercent >= 90 {
|
||||
h.Warning = fmt.Sprintf("A mentési meghajtó majdnem megtelt (%.0f%% használt).", di.UsedPercent)
|
||||
h.Severity = "warning"
|
||||
@@ -273,6 +279,7 @@ func ProbeStoragePath(path string) ProbeResult {
|
||||
|
||||
// Quick check: does the path exist at all?
|
||||
if _, err := os.Lstat(path); os.IsNotExist(err) {
|
||||
log.Printf("[WARN] [system] Storage path %s probe failed: %v", path, err)
|
||||
debugf("[DEBUG] [system] ProbeStoragePath: path=%q — not exists (%s)", path, time.Since(start).Round(time.Millisecond))
|
||||
return ProbeResult{Status: ProbeDisconnected, Err: err}
|
||||
}
|
||||
@@ -298,12 +305,15 @@ func ProbeStoragePath(path string) ProbeResult {
|
||||
if strings.Contains(errStr, "transport endpoint") ||
|
||||
strings.Contains(errStr, "input/output error") ||
|
||||
strings.Contains(errStr, "no such device") {
|
||||
log.Printf("[WARN] [system] Storage path %s probe failed: %v", path, res.err)
|
||||
debugf("[DEBUG] [system] ProbeStoragePath: path=%q — disconnected: %v (%s)", path, res.err, elapsed)
|
||||
return ProbeResult{Status: ProbeDisconnected, Err: res.err}
|
||||
}
|
||||
log.Printf("[WARN] [system] Storage path %s probe failed: %v", path, res.err)
|
||||
debugf("[DEBUG] [system] ProbeStoragePath: path=%q — disconnected (other error): %v (%s)", path, res.err, elapsed)
|
||||
return ProbeResult{Status: ProbeDisconnected, Err: res.err}
|
||||
case <-time.After(3 * time.Second):
|
||||
log.Printf("[WARN] [system] Storage path %s probe failed: stat timed out after 3s", path)
|
||||
debugf("[DEBUG] [system] ProbeStoragePath: path=%q — TIMEOUT (3s)", path)
|
||||
return ProbeResult{Status: ProbeTimeout, Err: fmt.Errorf("stat timed out after 3s")}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user