From b5c158d1b34c2140b17e165194786521c9f876af Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Sat, 19 Oct 2024 18:12:25 -0400 Subject: [PATCH] update debug logs --- beszel/internal/agent/agent.go | 3 +++ beszel/internal/agent/system.go | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/beszel/internal/agent/agent.go b/beszel/internal/agent/agent.go index df35f4fd..a902e862 100644 --- a/beszel/internal/agent/agent.go +++ b/beszel/internal/agent/agent.go @@ -2,6 +2,7 @@ package agent import ( + "beszel" "beszel/internal/entities/system" "context" "log/slog" @@ -47,6 +48,8 @@ func (a *Agent) Run(pubKey []byte, addr string) { } } + slog.Debug(beszel.Version) + // Set sensors context (allows overriding sys location for sensors) if sysSensors, exists := os.LookupEnv("SYS_SENSORS"); exists { slog.Info("SYS_SENSORS", "path", sysSensors) diff --git a/beszel/internal/agent/system.go b/beszel/internal/agent/system.go index 898459cd..b451151b 100644 --- a/beszel/internal/agent/system.go +++ b/beszel/internal/agent/system.go @@ -173,12 +173,12 @@ func (a *Agent) getSystemStats() system.Stats { // temperatures temps, err := sensors.TemperaturesWithContext(a.sensorsContext) - if err != nil && a.debug { - err.(*sensors.Warnings).Verbose = true - slog.Debug("Sensor error", "errs", err) + if err != nil { + // err.(*sensors.Warnings).Verbose = true + slog.Debug("Sensor error", "err", err) } + slog.Debug("Temperature", "sensors", temps) if len(temps) > 0 { - slog.Debug("Temperatures", "data", temps) systemStats.Temperatures = make(map[string]float64, len(temps)) for i, sensor := range temps { // skip if temperature is 0 @@ -209,6 +209,7 @@ func (a *Agent) getSystemStats() system.Stats { a.systemInfo.DiskPct = systemStats.DiskPct a.systemInfo.Uptime, _ = host.Uptime() a.systemInfo.Bandwidth = twoDecimals(systemStats.NetworkSent + systemStats.NetworkRecv) + slog.Debug("sysinfo", "data", a.systemInfo) return systemStats }