feat: comprehensive debug logging across all controller modules
Add detailed [DEBUG] logging to every controller module when logging.level is set to "debug". Each module with stateful debug uses SetDebug(bool) wired from main.go. Covers stacks, backup, cloudflare, integrations, system, monitor, settings, scheduler, web handlers, storage, metrics, API, selfupdate, and assets. Also includes the app export/import (.fab bundles) feature from v0.32.0 and its debug page integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ func NewCPUCollector(sampleRate time.Duration) *CPUCollector {
|
||||
// Start begins background CPU sampling.
|
||||
func (c *CPUCollector) Start(ctx context.Context) {
|
||||
ctx, c.cancel = context.WithCancel(ctx)
|
||||
debugf("[DEBUG] [system] CPUCollector.Start: sampleRate=%s", c.sampleRate)
|
||||
go c.loop(ctx)
|
||||
}
|
||||
|
||||
@@ -48,10 +49,12 @@ func (c *CPUCollector) CPUPercent() float64 {
|
||||
}
|
||||
|
||||
func (c *CPUCollector) loop(ctx context.Context) {
|
||||
firstSample := true
|
||||
for {
|
||||
// Read first sample
|
||||
idle1, total1, err := readCPUStat()
|
||||
if err != nil {
|
||||
debugf("[DEBUG] [system] CPUCollector: readCPUStat error: %v", err)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
@@ -82,6 +85,11 @@ func (c *CPUCollector) loop(ctx context.Context) {
|
||||
c.mu.Lock()
|
||||
c.cpuPercent = percent
|
||||
c.mu.Unlock()
|
||||
|
||||
if firstSample {
|
||||
debugf("[DEBUG] [system] CPUCollector: first sample — cpu=%.1f%% (idle=%d total=%d)", percent, idleDelta, totalDelta)
|
||||
firstSample = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user