diff --git a/src/ifmib/ifmib.go b/src/ifmib/ifmib.go index 7d39abd..52f4f1e 100644 --- a/src/ifmib/ifmib.go +++ b/src/ifmib/ifmib.go @@ -184,7 +184,7 @@ func (m *InterfaceMIB) UpdateStats(interfaceStats *api.InterfaceStats) { } if m.ifXTableSession != nil { m.ifXTableSession.Handler = m.handler - logger.Printf("Updated session handlers with new IF-MIB data") + logger.Printf("Updated session handlers with new IF-MIB data for %d interfaces", len(m.stats)) } logger.Debugf("IF-MIB now contains %d interfaces", len(m.stats)) diff --git a/src/vpp/vpp_iface.go b/src/vpp/vpp_iface.go index c22baef..2bc5b16 100644 --- a/src/vpp/vpp_iface.go +++ b/src/vpp/vpp_iface.go @@ -105,14 +105,14 @@ func (im *InterfaceManager) eventMonitoringRoutine() { if im.client.IsConnected() { if !im.watchingEvents { if err := im.InitializeEventWatching(); err != nil { - logger.Debugf("Failed to initialize interface event watching: %v", err) + logger.Printf("Failed to initialize interface event watching: %v", err) } else { - logger.Debugf("Interface event watching restarted after reconnection") + logger.Printf("Interface event watching started") } } } else { if im.watchingEvents { - logger.Debugf("VPP connection lost, interface event watching will restart on reconnection") + logger.Printf("VPP connection lost, interface event watching will restart on reconnection") im.watchingEvents = false } } @@ -264,7 +264,7 @@ func watchInterfaceEvents(ch api.Channel, callback func()) error { logger.Debugf("Interface event listener waiting for events...") for notif := range notifChan { e := notif.(*interfaces.SwInterfaceEvent) - logger.Debugf("interface event: SwIfIndex=%d, Flags=%d, Deleted=%t", + logger.Printf("interface event: SwIfIndex=%d, Flags=%d, Deleted=%t", e.SwIfIndex, e.Flags, e.Deleted) // When an interface event occurs, call the callback diff --git a/src/vpp/vpp_iface_test.go b/src/vpp/vpp_iface_test.go index 720e89b..5d54f65 100644 --- a/src/vpp/vpp_iface_test.go +++ b/src/vpp/vpp_iface_test.go @@ -32,6 +32,10 @@ func TestNewInterfaceManager(t *testing.T) { if manager.watchingEvents { t.Error("InterfaceManager should not be watching events initially") } + + if manager.hasConnectedBefore { + t.Error("InterfaceManager should not have hasConnectedBefore set initially") + } } func TestInterfaceManagerSetEventCallback(t *testing.T) { diff --git a/src/vpp/vpp_stats.go b/src/vpp/vpp_stats.go index 4cd69fa..2eb835c 100644 --- a/src/vpp/vpp_stats.go +++ b/src/vpp/vpp_stats.go @@ -95,11 +95,11 @@ func (sm *StatsManager) statsRoutine() { logger.Printf("VPP connection lost, attempting reconnect...") wasConnected = false } else { - logger.Debugf("VPP not connected, attempting connection...") + logger.Printf("VPP not connected, attempting connection...") } if err := sm.client.Connect(); err != nil { - logger.Debugf("Failed to connect to VPP: %v", err) + logger.Printf("Failed to connect to VPP: %v", err) time.Sleep(time.Second) continue } @@ -139,8 +139,8 @@ func (sm *StatsManager) queryAndReportStats() bool { return false } - // Always log basic info - logger.Printf("Retrieved stats for %d interfaces", len(stats.Interfaces)) + // Debug log basic info + logger.Debugf("Retrieved stats for %d interfaces", len(stats.Interfaces)) // Debug logging for individual interfaces for _, iface := range stats.Interfaces {