tighten up logging
This commit is contained in:
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user