move to untimestamped logs, tag the lots INFO and DEBUG. Update tests

This commit is contained in:
Pim van Pelt
2025-06-11 00:22:16 +02:00
parent 0a0e3e7055
commit d408ec2867
5 changed files with 101 additions and 36 deletions

16
main.go
View File

@ -5,10 +5,14 @@ package main
import (
"flag"
"log"
"os"
"os/signal"
"syscall"
"govpp-snmp-agentx/agentx"
"govpp-snmp-agentx/config"
"govpp-snmp-agentx/ifmib"
"govpp-snmp-agentx/logger"
"govpp-snmp-agentx/vppstats"
)
@ -38,6 +42,14 @@ func main() {
// Start VPP stats routine with callback to update MIB
vppstats.StartStatsRoutine(interfaceMIB.UpdateStats)
// Keep the main routine running
select {}
// Set up signal handling for graceful shutdown
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
// Wait for shutdown signal
<-sigChan
logger.Printf("Shutting down...")
// Flush any buffered log entries
logger.Sync()
}