mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 03:28:19 +01:00
chore: update logging
This commit is contained in:
6
wol.go
6
wol.go
@@ -11,7 +11,7 @@ func rpcSendWOLMagicPacket(macAddress string) error {
|
||||
// Parse the MAC address
|
||||
mac, err := net.ParseMAC(macAddress)
|
||||
if err != nil {
|
||||
return ErrorfL(&wolLogger, "invalid MAC address", err)
|
||||
return ErrorfL(wolLogger, "invalid MAC address", err)
|
||||
}
|
||||
|
||||
// Create the magic packet
|
||||
@@ -20,14 +20,14 @@ func rpcSendWOLMagicPacket(macAddress string) error {
|
||||
// Set up UDP connection
|
||||
conn, err := net.Dial("udp", "255.255.255.255:9")
|
||||
if err != nil {
|
||||
return ErrorfL(&wolLogger, "failed to establish UDP connection", err)
|
||||
return ErrorfL(wolLogger, "failed to establish UDP connection", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
// Send the packet
|
||||
_, err = conn.Write(packet)
|
||||
if err != nil {
|
||||
return ErrorfL(&wolLogger, "failed to send WOL packet", err)
|
||||
return ErrorfL(wolLogger, "failed to send WOL packet", err)
|
||||
}
|
||||
|
||||
wolLogger.Info().Str("mac", macAddress).Msg("WOL packet sent")
|
||||
|
||||
Reference in New Issue
Block a user