优化日志

This commit is contained in:
2025-11-28 14:37:53 +08:00
parent bc4355cad5
commit 04b46d8025
2 changed files with 4 additions and 4 deletions

View File

@@ -223,7 +223,7 @@ func (g *GeneralDeviceService) Collect(ctx context.Context, areaControllerID uin
logger.Errorf("创建待采集请求失败 (CorrelationID: %s): %v", correlationID, err) logger.Errorf("创建待采集请求失败 (CorrelationID: %s): %v", correlationID, err)
return err return err
} }
logger.Infof("成功创建待采集请求 (CorrelationID: %s, DeviceID: %d)", correlationID, areaController.ID) logger.Debugf("成功创建待采集请求 (CorrelationID: %s, DeviceID: %d)", correlationID, areaController.ID)
// 5. 构建最终的空中载荷 // 5. 构建最终的空中载荷
batchCmd := &proto.BatchCollectCommand{ batchCmd := &proto.BatchCollectCommand{
@@ -240,12 +240,12 @@ func (g *GeneralDeviceService) Collect(ctx context.Context, areaControllerID uin
logger.Errorf("序列化采集指令失败 (CorrelationID: %s): %v", correlationID, err) logger.Errorf("序列化采集指令失败 (CorrelationID: %s): %v", correlationID, err)
return err return err
} }
logger.Infof("构造空中载荷成功: networkID: %v, payload: %v", networkID, instruction) logger.Debugf("构造空中载荷成功: networkID: %v, payload: %v", networkID, instruction)
if _, err := g.comm.Send(serviceCtx, networkID, payload); err != nil { if _, err := g.comm.Send(serviceCtx, networkID, payload); err != nil {
logger.DPanicf("待采集请求 (CorrelationID: %s) 已创建,但发送到设备失败: %v。数据可能不一致", correlationID, err) logger.DPanicf("待采集请求 (CorrelationID: %s) 已创建,但发送到设备失败: %v。数据可能不一致", correlationID, err)
return err return err
} }
logger.Infof("成功将采集请求 (CorrelationID: %s) 发送到设备 %s", correlationID, networkID) logger.Debugf("成功将采集请求 (CorrelationID: %s) 发送到设备 %s", correlationID, networkID)
return nil return nil
} }

View File

@@ -266,7 +266,7 @@ func (t *LoRaMeshUartPassthroughTransport) executeSend(ctx context.Context, req
frame.WriteByte(currentChunk) // 当前包序号 frame.WriteByte(currentChunk) // 当前包序号
frame.Write(chunk) // 数据块 frame.Write(chunk) // 数据块
logger.Infof("构建LoRa数据包: %v", frame.Bytes()) logger.Debugf("构建LoRa数据包: %v", frame.Bytes())
_, err := t.port.Write(frame.Bytes()) _, err := t.port.Write(frame.Bytes())
if err != nil { if err != nil {
return nil, fmt.Errorf("写入串口失败: %w", err) return nil, fmt.Errorf("写入串口失败: %w", err)