Add logging
This commit is contained in:
parent
aad6e32082
commit
a53c12b02c
@ -65,10 +65,16 @@ struct DeviceResponse {
|
|||||||
}
|
}
|
||||||
self.event = event
|
self.event = event
|
||||||
guard let data = buffer.getSlice(at: 1, length: Message.length) else {
|
guard let data = buffer.getSlice(at: 1, length: Message.length) else {
|
||||||
|
log("\(request): Insufficient data received from device (expected \(Message.length + 1), got \(buffer.readableBytes))")
|
||||||
self.response = nil
|
self.response = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.response = Message(decodeFrom: data)
|
guard let message = Message(decodeFrom: data) else {
|
||||||
|
log("\(request): Failed to decode message received from device")
|
||||||
|
self.response = nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.response = message
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user