remove use of glog

This commit is contained in:
Asim
2016-03-14 11:01:10 +00:00
parent c0b25e7a65
commit d1eae8fabe
12 changed files with 46 additions and 85 deletions

View File

@@ -2,8 +2,8 @@ package main
import (
"fmt"
"log"
log "github.com/golang/glog"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/cmd"
// To enable rabbitmq plugin uncomment

View File

@@ -2,9 +2,9 @@ package main
import (
"fmt"
"log"
"time"
log "github.com/golang/glog"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/cmd"
)
@@ -24,7 +24,7 @@ func pub() {
Body: []byte(fmt.Sprintf("%d: %s", i, time.Now().String())),
}
if err := broker.Publish(topic, msg); err != nil {
log.Errorf("[pub] failed: %v", err)
log.Printf("[pub] failed: %v", err)
} else {
fmt.Println("[pub] pubbed message:", string(msg.Body))
}

View File

@@ -2,9 +2,9 @@ package main
import (
"fmt"
"log"
"time"
log "github.com/golang/glog"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/cmd"
// To enable rabbitmq plugin uncomment
@@ -26,7 +26,7 @@ func pub() {
Body: []byte(fmt.Sprintf("%d: %s", i, time.Now().String())),
}
if err := broker.Publish(topic, msg); err != nil {
log.Errorf("[pub] failed: %v", err)
log.Printf("[pub] failed: %v", err)
} else {
fmt.Println("[pub] pubbed message:", string(msg.Body))
}

View File

@@ -1,7 +1,8 @@
package main
import (
log "github.com/golang/glog"
"log"
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/examples/server/subscriber"
"github.com/micro/go-micro/server"
@@ -13,16 +14,16 @@ import (
type Example struct{}
func (e *Example) Call(ctx context.Context, req *example.Request, rsp *example.Response) error {
log.Info("Received Example.Call request")
log.Print("Received Example.Call request")
rsp.Msg = server.DefaultOptions().Id + ": Hello " + req.Name
return nil
}
func (e *Example) Stream(ctx context.Context, req *example.StreamingRequest, stream example.Example_StreamStream) error {
log.Infof("Received Example.Stream request with count: %d", req.Count)
log.Printf("Received Example.Stream request with count: %d", req.Count)
for i := 0; i < int(req.Count); i++ {
log.Infof("Responding: %d", i)
log.Printf("Responding: %d", i)
if err := stream.Send(&example.StreamingResponse{
Count: int64(i),
}); err != nil {
@@ -39,7 +40,7 @@ func (e *Example) PingPong(ctx context.Context, stream example.Example_PingPongS
if err != nil {
return err
}
log.Infof("Got ping %v", req.Stroke)
log.Printf("Got ping %v", req.Stroke)
if err := stream.Send(&example.Pong{Stroke: req.Stroke}); err != nil {
return err
}

View File

@@ -1,7 +1,8 @@
package handler
import (
log "github.com/golang/glog"
"log"
example "github.com/micro/go-micro/examples/server/proto/example"
"github.com/micro/go-micro/metadata"
"github.com/micro/go-micro/server"
@@ -13,25 +14,25 @@ type Example struct{}
func (e *Example) Call(ctx context.Context, req *example.Request, rsp *example.Response) error {
md, _ := metadata.FromContext(ctx)
log.Infof("Received Example.Call request with metadata: %v", md)
log.Printf("Received Example.Call request with metadata: %v", md)
rsp.Msg = server.DefaultOptions().Id + ": Hello " + req.Name
return nil
}
func (e *Example) Stream(ctx context.Context, stream server.Streamer) error {
log.Info("Executing streaming handler")
log.Print("Executing streaming handler")
req := &example.StreamingRequest{}
// We just want to receive 1 request and then process here
if err := stream.Recv(req); err != nil {
log.Errorf("Error receiving streaming request: %v", err)
log.Printf("Error receiving streaming request: %v", err)
return err
}
log.Infof("Received Example.Stream request with count: %d", req.Count)
log.Printf("Received Example.Stream request with count: %d", req.Count)
for i := 0; i < int(req.Count); i++ {
log.Infof("Responding: %d", i)
log.Printf("Responding: %d", i)
if err := stream.Send(&example.StreamingResponse{
Count: int64(i),
@@ -49,7 +50,7 @@ func (e *Example) PingPong(ctx context.Context, stream server.Streamer) error {
if err := stream.Recv(req); err != nil {
return err
}
log.Infof("Got ping %v", req.Stroke)
log.Printf("Got ping %v", req.Stroke)
if err := stream.Send(&example.Pong{Stroke: req.Stroke}); err != nil {
return err
}

View File

@@ -1,7 +1,8 @@
package main
import (
log "github.com/golang/glog"
"log"
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/examples/server/handler"
"github.com/micro/go-micro/examples/server/subscriber"

View File

@@ -1,7 +1,8 @@
package subscriber
import (
log "github.com/golang/glog"
"log"
example "github.com/micro/go-micro/examples/server/proto/example"
"golang.org/x/net/context"
)
@@ -9,11 +10,11 @@ import (
type Example struct{}
func (e *Example) Handle(ctx context.Context, msg *example.Message) error {
log.Info("Handler Received message: ", msg.Say)
log.Print("Handler Received message: ", msg.Say)
return nil
}
func Handler(ctx context.Context, msg *example.Message) error {
log.Info("Function Received message: ", msg.Say)
log.Print("Function Received message: ", msg.Say)
return nil
}