From 4724685dc3d9e0934fa2a3b1c843910389b117b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=A2=A7=E8=97=A4?= <2957035701@qq.com> Date: Tue, 21 May 2024 00:44:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20=E6=B7=BB=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E7=B2=BE=E7=A1=AE=E5=88=B0=E7=A7=92=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- grpc_impl/log_server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grpc_impl/log_server.go b/grpc_impl/log_server.go index a65963f..ded4687 100644 --- a/grpc_impl/log_server.go +++ b/grpc_impl/log_server.go @@ -5,6 +5,7 @@ import ( "ceobe-bot/conf" "ceobe-bot/global" "context" + "time" "github.com/tencent-connect/botgo/dto" ) @@ -20,6 +21,7 @@ func NewLogServer() *LogServer { // 从grpc接收日志并推送到频道中 func (l *LogServer) PushLog(ctx context.Context, in *pb.LogRequest) (*pb.LogResponse, error) { content := "" + switch in.Server { case pb.LogRequest_RUST: content += "服务端:rust端\n" @@ -36,6 +38,10 @@ func (l *LogServer) PushLog(ctx context.Context, in *pb.LogRequest) (*pb.LogResp } else { content += "是否人工介入:否\n" } + now := time.Now() + // 格式化为精确到秒的时间字符串 + timeStr := now.Format("2006-01-02 15:04:05") + content += "当前时间:" + timeStr + "\n" content += "信息:" + in.Info if in.Extra != "" { content += "\n---- 以下是额外内容 ----\n" + in.Extra