fix: standardize log prefixes, remove duplicates, add missing module tags
Second-pass logging cleanup: consistent [LEVEL] [module] format across all 41 files. Remove stale prefixes ([CF], [SYNC], [SCHED], [API], [STORAGE], [HEALTH], [ROLLBACK]). Remove 5 duplicate log lines. Gate ungated DEBUG lines. Fix wrong log levels (restore start WARN→INFO). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,7 +72,7 @@ func (p *Pusher) Push(report *Report) error {
|
||||
|
||||
url := p.hubURL + "/api/v1/report"
|
||||
if p.debug {
|
||||
p.logger.Printf("[DEBUG] Push: url=%s payload=%d bytes", url, len(data))
|
||||
p.logger.Printf("[DEBUG] [report] Push: url=%s payload=%d bytes", url, len(data))
|
||||
}
|
||||
|
||||
p.statusMu.Lock()
|
||||
@@ -106,7 +106,7 @@ func (p *Pusher) Push(report *Report) error {
|
||||
resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
|
||||
p.logger.Printf("[INFO] Hub report pushed successfully (%d bytes)", len(data))
|
||||
p.logger.Printf("[INFO] [report] Hub report pushed successfully (%d bytes)", len(data))
|
||||
p.statusMu.Lock()
|
||||
p.status.LastSuccess = time.Now()
|
||||
p.status.LastError = ""
|
||||
@@ -151,7 +151,7 @@ func (p *Pusher) PushInfraBackup(data []byte) error {
|
||||
|
||||
url := p.hubURL + "/api/v1/infra-backup"
|
||||
if p.debug {
|
||||
p.logger.Printf("[DEBUG] PushInfraBackup: url=%s payload=%d bytes", url, len(data))
|
||||
p.logger.Printf("[DEBUG] [report] PushInfraBackup: url=%s payload=%d bytes", url, len(data))
|
||||
}
|
||||
|
||||
var lastErr error
|
||||
@@ -179,12 +179,12 @@ func (p *Pusher) PushInfraBackup(data []byte) error {
|
||||
resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
|
||||
p.logger.Printf("[INFO] Infra backup pushed to Hub (%d bytes)", len(data))
|
||||
p.logger.Printf("[INFO] [report] Infra backup pushed to Hub (%d bytes)", len(data))
|
||||
return nil
|
||||
}
|
||||
lastErr = fmt.Errorf("HTTP %d", resp.StatusCode)
|
||||
if p.debug {
|
||||
p.logger.Printf("[DEBUG] PushInfraBackup: attempt %d failed — HTTP %d", attempt+1, resp.StatusCode)
|
||||
p.logger.Printf("[DEBUG] [report] PushInfraBackup: attempt %d failed — HTTP %d", attempt+1, resp.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (p *Pusher) PushOnce(report *Report) error {
|
||||
resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
|
||||
p.logger.Printf("[INFO] Hub push-once sent (%d bytes)", len(data))
|
||||
p.logger.Printf("[INFO] [report] Hub push-once sent (%d bytes)", len(data))
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("hub push-once: HTTP %d", resp.StatusCode)
|
||||
|
||||
Reference in New Issue
Block a user