From d23a91650a10dd790720c5b39ab518e08fd46dc6 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Wed, 9 Jun 2021 11:14:44 +0800 Subject: [PATCH] fix log print (#1021) --- examples/helloworld/client/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/helloworld/client/main.go b/examples/helloworld/client/main.go index 2e087efe0..8e7c7f5b0 100644 --- a/examples/helloworld/client/main.go +++ b/examples/helloworld/client/main.go @@ -37,15 +37,15 @@ func callHTTP() { if err != nil { panic(err) } - logger.Log(log.LevelInfo, fmt.Sprintf("[http] SayHello %s\n", reply.Message)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[http] SayHello %s\n", reply.Message)) // returns error reply, err = client.SayHello(context.Background(), &pb.HelloRequest{Name: "error"}) if err != nil { - logger.Log(log.LevelInfo, fmt.Sprintf("[http] SayHello error: %v\n", err)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[http] SayHello error: %v\n", err)) } if errors.IsBadRequest(err) { - logger.Log(log.LevelInfo, fmt.Sprintf("[http] SayHello error is invalid argument: %v\n", err)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[http] SayHello error is invalid argument: %v\n", err)) } } @@ -69,14 +69,14 @@ func callGRPC() { if err != nil { panic(err) } - logger.Log(log.LevelInfo, fmt.Sprintf("[grpc] SayHello %+v", reply)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[grpc] SayHello %+v", reply)) // returns error _, err = client.SayHello(context.Background(), &pb.HelloRequest{Name: "error"}) if err != nil { - logger.Log(log.LevelInfo, fmt.Sprintf("[grpc] SayHello error: %v", err)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[grpc] SayHello error: %v", err)) } if errors.IsBadRequest(err) { - logger.Log(log.LevelInfo, fmt.Sprintf("[grpc] SayHello error is invalid argument: %v", err)) + logger.Log(log.LevelInfo, "msg", fmt.Sprintf("[grpc] SayHello error is invalid argument: %v", err)) } }