Reduce amount of logging

This commit is contained in:
Christoph Hagen 2023-12-12 23:08:50 +01:00
parent ad1c959ead
commit 7968f64581

View File

@ -92,7 +92,6 @@ final class DeviceManager {
// Check if a full message has already been received
if let receivedMessageData, receivedMessageData.count == SignedMessage.size {
log("[INFO] Full message from socket collected early")
self.receivedMessageData = nil
return receivedMessageData
}
@ -101,14 +100,13 @@ final class DeviceManager {
self.requestInProgress = continuation
}
await updateMessageCountMetric()
log("[INFO] Message completed")
return result
}
private func startTimeoutForDeviceRequest(on eventLoop: EventLoop) {
eventLoop.scheduleTask(in: .seconds(deviceTimeout)) { [weak self] in
guard let self else {
log("[INFO] No reference to self after timeout of message")
log("[WARN] No reference to self after timeout of message")
return
}
self.resumeDeviceRequest(with: .deviceTimedOut)
@ -143,7 +141,6 @@ final class DeviceManager {
private func resumeDeviceRequest(with result: MessageResult) {
guard let receivedMessageData else {
log("[WARN] Result after message completed: \(result)")
self.requestInProgress = nil
return
}
@ -163,13 +160,7 @@ final class DeviceManager {
func processDeviceResponse(_ buffer: ByteBuffer) {
guard let data = buffer.getData(at: 0, length: buffer.readableBytes) else {
log("Failed to get data buffer received from device")
self.resumeDeviceRequest(with: .invalidMessageSizeFromDevice)
return
}
guard data.count == SignedMessage.size else {
log("Invalid size of device message: \(data.count)")
log("[WARN] Failed to get data buffer received from device")
self.resumeDeviceRequest(with: .invalidMessageSizeFromDevice)
return
}
@ -227,7 +218,6 @@ final class DeviceManager {
self.didCloseDeviceSocket()
}
}
log("[INFO] Socket connected")
await updateDeviceConnectionMetrics()
}
}