You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ch...@apache.org on 2021/11/26 06:00:20 UTC
[dubbo-go] branch 3.0 updated: feat: change log to dubbo go logger
This is an automated email from the ASF dual-hosted git repository.
chenjiapeng pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/3.0 by this push:
new 70deec6 feat: change log to dubbo go logger
new a6aa373 Merge pull request #1617 from cjphaha/feature/cjphaha_use_dubbo_logger
70deec6 is described below
commit 70deec62211dac0d360262432f5922d80f5c37bc
Author: 氕氘氚 <cj...@163.com>
AuthorDate: Fri Nov 26 00:03:28 2021 +0800
feat: change log to dubbo go logger
---
protocol/dubbo3/internal/server.go | 4 ++--
protocol/grpc/internal/helloworld/server.go | 7 +++++--
protocol/grpc/internal/routeguide/client.go | 10 +++++-----
protocol/grpc/internal/routeguide/server.go | 5 ++++-
4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/protocol/dubbo3/internal/server.go b/protocol/dubbo3/internal/server.go
index 51021c8..79ce479 100644
--- a/protocol/dubbo3/internal/server.go
+++ b/protocol/dubbo3/internal/server.go
@@ -19,11 +19,11 @@ package internal
import (
"context"
- "log"
)
import (
"dubbo.apache.org/dubbo-go/v3/common"
+ log "dubbo.apache.org/dubbo-go/v3/common/logger"
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"
@@ -37,7 +37,7 @@ type Server struct {
// SayHello implements helloworld.GreeterServer
func (s *Server) SayHello(ctx context.Context, in *HelloRequest) (*HelloReply, error) {
- log.Printf("Received: %v", in.GetName())
+ log.Infof("Received: %v", in.GetName())
return &HelloReply{Message: "Hello " + in.GetName()}, nil
}
diff --git a/protocol/grpc/internal/helloworld/server.go b/protocol/grpc/internal/helloworld/server.go
index 99f5b68..cf12571 100644
--- a/protocol/grpc/internal/helloworld/server.go
+++ b/protocol/grpc/internal/helloworld/server.go
@@ -19,7 +19,6 @@ package helloworld
import (
"context"
- "log"
"net"
)
@@ -27,6 +26,10 @@ import (
"google.golang.org/grpc"
)
+import (
+ log "dubbo.apache.org/dubbo-go/v3/common/logger"
+)
+
// server is used to implement helloworld.GreeterServer.
type server struct {
*GreeterProviderBase
@@ -40,7 +43,7 @@ func NewService() *server {
// SayHello implements helloworld.GreeterServer
func (s *server) SayHello(ctx context.Context, in *HelloRequest) (*HelloReply, error) {
- log.Printf("Received: %v", in.GetName())
+ log.Infof("Received: %v", in.GetName())
return &HelloReply{Message: "Hello " + in.GetName()}, nil
}
diff --git a/protocol/grpc/internal/routeguide/client.go b/protocol/grpc/internal/routeguide/client.go
index dd870b7..8e9bdbe 100644
--- a/protocol/grpc/internal/routeguide/client.go
+++ b/protocol/grpc/internal/routeguide/client.go
@@ -19,12 +19,12 @@ package routeguide
import (
"io"
- "log"
"math/rand"
"time"
)
import (
+ log "dubbo.apache.org/dubbo-go/v3/common/logger"
"dubbo.apache.org/dubbo-go/v3/config"
)
@@ -43,7 +43,7 @@ func PrintFeatures(stream RouteGuide_ListFeaturesClient) {
if err != nil {
log.Fatalf("Fait to receive a feature: %v", err)
}
- log.Printf("Feature: name: %q, point:(%v, %v)", feature.GetName(),
+ log.Infof("Feature: name: %q, point:(%v, %v)", feature.GetName(),
feature.GetLocation().GetLatitude(), feature.GetLocation().GetLongitude())
}
}
@@ -57,7 +57,7 @@ func RunRecordRoute(stream RouteGuide_RecordRouteClient) {
for i := 0; i < pointCount; i++ {
points = append(points, randomPoint(r))
}
- log.Printf("Traversing %d points.", len(points))
+ log.Infof("Traversing %d points.", len(points))
for _, point := range points {
if err := stream.Send(point); err != nil {
log.Fatalf("%v.Send(%v) = %v", stream, point, err)
@@ -67,7 +67,7 @@ func RunRecordRoute(stream RouteGuide_RecordRouteClient) {
if err != nil {
log.Fatalf("%v.CloseAndRecv() got error %v, want %v", stream, err, nil)
}
- log.Printf("Route summary: %v", reply)
+ log.Infof("Route summary: %v", reply)
}
// runRouteChat receives a sequence of route notes, while sending notes for various locations.
@@ -92,7 +92,7 @@ func RunRouteChat(stream RouteGuide_RouteChatClient) {
if err != nil {
log.Fatalf("Failed to receive a note : %v", err)
}
- log.Printf("Got message %s at point(%d, %d)", in.Message, in.Location.Latitude, in.Location.Longitude)
+ log.Infof("Got message %s at point(%d, %d)", in.Message, in.Location.Latitude, in.Location.Longitude)
}
}()
for _, note := range notes {
diff --git a/protocol/grpc/internal/routeguide/server.go b/protocol/grpc/internal/routeguide/server.go
index 9434949..d13fab5 100644
--- a/protocol/grpc/internal/routeguide/server.go
+++ b/protocol/grpc/internal/routeguide/server.go
@@ -22,7 +22,6 @@ import (
"encoding/json"
"fmt"
"io"
- "log"
"math"
"net"
"sync"
@@ -35,6 +34,10 @@ import (
"google.golang.org/grpc"
)
+import (
+ log "dubbo.apache.org/dubbo-go/v3/common/logger"
+)
+
type routeGuideServer struct {
*RouteGuideProviderBase
savedFeatures []*Feature // read-only after initialized