Silence glog crap
This commit is contained in:
parent
702826c0b7
commit
a15dafbca6
2 changed files with 15 additions and 14 deletions
|
@ -14,8 +14,13 @@ import (
|
||||||
opentracing "github.com/opentracing/opentracing-go"
|
opentracing "github.com/opentracing/opentracing-go"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
"google.golang.org/grpc/grpclog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
grpclog.SetLogger(discard{})
|
||||||
|
}
|
||||||
|
|
||||||
type grpcClient struct {
|
type grpcClient struct {
|
||||||
dialOpts []grpc.DialOption
|
dialOpts []grpc.DialOption
|
||||||
clients map[string]pb.DnsServiceClient
|
clients map[string]pb.DnsServiceClient
|
||||||
|
@ -92,3 +97,13 @@ func (g *grpcClient) OnStartup(p *Proxy) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// discard is a Logger that outputs nothing.
|
||||||
|
type discard struct{}
|
||||||
|
|
||||||
|
func (d discard) Fatal(args ...interface{}) {}
|
||||||
|
func (d discard) Fatalf(format string, args ...interface{}) {}
|
||||||
|
func (d discard) Fatalln(args ...interface{}) {}
|
||||||
|
func (d discard) Print(args ...interface{}) {}
|
||||||
|
func (d discard) Printf(format string, args ...interface{}) {}
|
||||||
|
func (d discard) Println(args ...interface{}) {}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package proxy
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc/grpclog"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func pool() []*UpstreamHost {
|
func pool() []*UpstreamHost {
|
||||||
|
@ -19,8 +17,6 @@ func pool() []*UpstreamHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStartupShutdown(t *testing.T) {
|
func TestStartupShutdown(t *testing.T) {
|
||||||
grpclog.SetLogger(discard{})
|
|
||||||
|
|
||||||
upstream := &staticUpstream{
|
upstream := &staticUpstream{
|
||||||
from: ".",
|
from: ".",
|
||||||
Hosts: pool(),
|
Hosts: pool(),
|
||||||
|
@ -56,13 +52,3 @@ func TestStartupShutdown(t *testing.T) {
|
||||||
t.Errorf("Shutdown didn't remove conns, found %d", len(g.conns))
|
t.Errorf("Shutdown didn't remove conns, found %d", len(g.conns))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// discard is a Logger that outputs nothing.
|
|
||||||
type discard struct{}
|
|
||||||
|
|
||||||
func (d discard) Fatal(args ...interface{}) {}
|
|
||||||
func (d discard) Fatalf(format string, args ...interface{}) {}
|
|
||||||
func (d discard) Fatalln(args ...interface{}) {}
|
|
||||||
func (d discard) Print(args ...interface{}) {}
|
|
||||||
func (d discard) Printf(format string, args ...interface{}) {}
|
|
||||||
func (d discard) Println(args ...interface{}) {}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue