From e31d68c1e10aff961831527fc36b1cb5943c33d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 2 Dec 2021 15:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86RPC=E8=BF=9E=E6=8E=A5=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=BA=A7=E5=88=AB=E4=BB=8Eerror=E6=94=B9=E4=B8=BAwarn?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/remotelogs/utils.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/remotelogs/utils.go b/internal/remotelogs/utils.go index 5f950e2..26681f1 100644 --- a/internal/remotelogs/utils.go +++ b/internal/remotelogs/utils.go @@ -12,6 +12,7 @@ import ( "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/types" + "strings" "time" ) @@ -75,12 +76,18 @@ func Warn(tag string, description string) { func Error(tag string, description string) { logs.Println("[" + tag + "]" + description) + // 忽略RPC连接错误 + var level = "error" + if strings.Contains(description, "code = Unavailable desc = connection closed") { + level = "warning" + } + select { case logChan <- &pb.NodeLog{ Role: teaconst.Role, Tag: tag, Description: description, - Level: "error", + Level: level, NodeId: teaconst.NodeId, CreatedAt: time.Now().Unix(), }: