소스 검색

优化日志信息

longan 11 달 전
부모
커밋
94bfc63356
2개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      lc/IDevice.go
  2. 9 0
      log/info.20231211.log

+ 2 - 2
lc/IDevice.go

@@ -47,10 +47,10 @@ func (id *IntersectionDevice) ReConnect() {
 	if !id.S.IsLive {
 		conn, err := net.DialTimeout("tcp", id.Info.ScreenIp+":5000", 5*time.Second)
 		if err != nil {
-			logrus.Error("连接", id.Info.ScreenIp, "失败!error:", err)
+			logrus.WithFields(map[string]interface{}{"设备名": id.Info.Name, "IP": id.Info.ScreenIp, "error": err}).Error("屏重连接失败!")
 			return
 		}
-		logrus.Info("连接", id.Info.ScreenIp, "成功!")
+		logrus.WithFields(map[string]interface{}{"设备名": id.Info.Name, "IP": id.Info.ScreenIp}).Info("屏重连接成功!")
 		id.S.Conn = conn
 		id.S.IsLive = true
 	}

+ 9 - 0
log/info.20231211.log

@@ -184,3 +184,12 @@
 {"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:53:33+08:00"}
 {"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:53:42+08:00"}
 {"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:54:01+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:54:26+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:54:44+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:54:44+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:54:45+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:55:13+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:55:15+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:55:34+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:55:40+08:00"}
+{"file":"D:/goProject/lc-smartX/lc/event.go:57","func":"lc-smartX/lc.(*Server).Callback","level":"debug","msg":"camera 192.168.1.64 Callback","time":"2023-12-11T09:56:03+08:00"}