Browse Source

优化日志信息

longan 11 months ago
parent
commit
94bfc63356
2 changed files with 11 additions and 2 deletions
  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 {
 	if !id.S.IsLive {
 		conn, err := net.DialTimeout("tcp", id.Info.ScreenIp+":5000", 5*time.Second)
 		conn, err := net.DialTimeout("tcp", id.Info.ScreenIp+":5000", 5*time.Second)
 		if err != nil {
 		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
 			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.Conn = conn
 		id.S.IsLive = true
 		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: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: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: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"}