mirror of
https://github.com/jetkvm/kvm.git
synced 2026-05-21 05:20:35 +00:00
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:
@@ -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")
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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().
|
||||
|
||||
Reference in New Issue
Block a user