Refactor logging levels and enhance debug messages across multiple components (#1142)

- Changed log level from WARN to DEBUG for session-related messages in hidrpc.go to reduce noise during expected conditions.
- Adjusted logging in nmlite/interface.go to use DEBUG for non-critical DHCP lease messages and router solicitation failures.
- Improved link manager logging in nmlite/link/manager.go to differentiate between expected and persistent interface down states.
- Enhanced DHCP client logging in udhcpc/udhcpc.go to indicate non-fatal errors when calculating lease expiry.
This commit is contained in:
Adam Shiervani
2026-01-08 21:39:57 +01:00
committed by GitHub
parent 8775dab2fa
commit 5edba66e38
3 changed files with 12 additions and 4 deletions
+3 -2
View File
@@ -189,12 +189,13 @@ func handleHidRPCKeyboardInput(message hidrpc.Message) error {
func reportHidRPC(params any, session *Session) {
if session == nil {
logger.Warn().Msg("session is nil, skipping reportHidRPC")
logger.Debug().Msg("session is nil, skipping reportHidRPC")
return
}
if !session.hidRPCAvailable || session.HidChannel == nil {
logger.Warn().
// Expected during WebRTC handshake before HID channel is ready
logger.Debug().
Bool("hidRPCAvailable", session.hidRPCAvailable).
Bool("HidChannel", session.HidChannel != nil).
Msg("HID RPC is not available, skipping reportHidRPC")
+7 -1
View File
@@ -197,7 +197,13 @@ func (nm *NetlinkManager) EnsureInterfaceUpWithTimeout(ctx context.Context, ifac
l.Info().Msg("interface is up")
return link, nil
}
l.Warn().Msg("interface is still down, retrying")
// Use Info for first 5 attempts (expected during boot while PHY negotiates),
// then Warn for persistent failures
if attempt < 5 {
l.Info().Msg("waiting for interface to come up")
} else {
l.Warn().Msg("interface is still down, retrying")
}
select {
case <-time.After(500 * time.Millisecond):
+2 -1
View File
@@ -179,7 +179,8 @@ func (c *DHCPClient) loadLeaseFile() error {
leaseExpiry, err := lease.SetLeaseExpiry()
if err != nil {
c.logger.Error().Err(err).Msg("failed to get dhcp lease expiry")
// Non-fatal: lease still works, we just can't calculate expiry time
c.logger.Debug().Err(err).Msg("could not calculate dhcp lease expiry")
} else {
expiresIn := time.Until(leaseExpiry)
c.logger.Info().