Repository: go-kratos/kratos
Pull request #918 (2021-05-17 04:21:23)

log: add level printer
#882 

Windfarer: +1

Patch:
diff --git a/app.go b/app.go
index 1b5c42d8..0758e8bd 100644
--- a/app.go
+++ b/app.go
@@ -42,7 +42,7 @@ func New(opts ...Option) *App {
 		ctx:      ctx,
 		cancel:   cancel,
 		instance: buildInstance(options),
-		log:      log.NewHelper("app", options.logger),
+		log:      log.NewHelper(options.logger),
 	}
 }
 
diff --git a/config/config.go b/config/config.go
index f8a1ac5d..de08bbdb 100644
--- a/config/config.go
+++ b/config/config.go
@@ -54,7 +54,7 @@ func New(opts ...Option) Config {
 	return &config{
 		opts:   options,
 		reader: newReader(options),
-		log:    log.NewHelper("config", options.logger),
+		log:    log.NewHelper(options.logger),
 	}
 }
 
diff --git a/examples/blog/internal/data/article.go b/examples/blog/internal/data/article.go
index 2b323dbc..d951746a 100644
--- a/examples/blog/internal/data/article.go
+++ b/examples/blog/internal/data/article.go
@@ -2,9 +2,10 @@ package data
 
 import (
 	"context"
+	"time"
+
 	"github.com/go-kratos/kratos/examples/blog/internal/biz"
 	"github.com/go-kratos/kratos/v2/log"
-	"time"
 )
 
 type articleRepo struct {
@@ -16,7 +17,7 @@ type articleRepo struct {
 func NewArticleRepo(data *Data, logger log.Logger) biz.ArticleRepo {
 	return &articleRepo{
 		data: data,
-		log:  log.NewHelper("article_repo", logger),
+		log:  log.NewHelper(logger),
 	}
 }
 
diff --git a/examples/blog/internal/data/data.go b/examples/blog/internal/data/data.go
index 725cc26f..67254f17 100644
--- a/examples/blog/internal/data/data.go
+++ b/examples/blog/internal/data/data.go
@@ -25,7 +25,7 @@ type Data struct {
 
 // NewData .
 func NewData(conf *conf.Data, logger log.Logger) (*Data, func(), error) {
-	log := log.NewHelper("data", logger)
+	log := log.NewHelper(logger)
 	client, err := ent.Open(
 		conf.Database.Driver,
 		conf.Database.Source,
diff --git a/examples/blog/internal/service/article.go b/examples/blog/internal/service/article.go
index 2b8ba828..e72a7d18 100644
--- a/examples/blog/internal/service/article.go
+++ b/examples/blog/internal/service/article.go
@@ -2,6 +2,7 @@ package service
 
 import (
 	"context"
+
 	"go.opentelemetry.io/otel"
 
 	pb "github.com/go-kratos/kratos/examples/blog/api/blog/v1"
@@ -13,7 +14,7 @@ import (
 func NewBlogService(article *biz.ArticleUsecase, logger log.Logger) *BlogService {
 	return &BlogService{
 		article: article,
-		log:     log.NewHelper("article", logger),
+		log:     log.NewHelper(logger),
 	}
 }
 
diff --git a/examples/helloworld/server/main.go b/examples/helloworld/server/main.go
index 33e11de3..e957251e 100644
--- a/examples/helloworld/server/main.go
+++ b/examples/helloworld/server/main.go
@@ -43,7 +43,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe
 func main() {
 	logger := log.NewStdLogger(os.Stdout)
 
-	log := log.NewHelper("main", logger)
+	log := log.NewHelper(logger)
 
 	grpcSrv := grpc.NewServer(
 		grpc.Address(":9000"),
diff --git a/log/README.md b/log/README.md
index 4dba3be8..b1686903 100644
--- a/log/README.md
+++ b/log/README.md
@@ -5,41 +5,20 @@
 ### Structured logging
 
 ```go
-logger := log.NewStdLogger(os.Stdout)
-logger = log.With(logger, "caller", log.DefaultCaller, "ts", log.DefaultTimestamp)
+Logger logger = log.MultiLogger(log.NewStdLogger(os.Stdout), syslog.NewLogger())
 
-// Levels
-log.Debug(logger).Log("msg", "foo bar")
-log.Info(logger).Log("msg", "foo bar")
-log.Warn(logger).Log("msg", "foo bar")
-log.Error(logger).Log("msg", "foo bar")
-
-errLogger := log.Error(logger)
-errLogger.Log("msg", "xxx")
-errLogger.Log("msg", "yyy")
-errLogger.Log("msg", "zzz")
-
-errLogger.Log(
-    "http.scheme", "https",
-    "http.host", "translate.googleapis.com",
-    "http.target", "/language/translate",
-    "http.method", "post",
-    "http.status_code", 500,
-    "http.flavor", "1.1.",
-    "http.user_agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
+logger = log.With(logger,
+    "service.name", "hellworld",
+    "service.version", "v1.0.0",
+    "ts", log.DefaultTimestamp,
+    "caller", log.DefaultCaller,
 )
 
-// Helper
-logger := log.NewHelper("github.com/project/foo", log.DefaultLogger)
-logger.Info("hello")
-logger.Infof("foo %s", "bar")
-logger.Infow("key", "value")
+logger.Log(log.LevelInfo, "key", "value")
 
-// Verbose
-v := NewVerbose(log.DefaultLogger, 20)
-
-v.V(10).Log("foo", "bar1")
-v.V(20).Log("foo", "bar2")
-v.V(30).Log("foo", "bar3")
+Helper helper = log.NewHelper(logger)
+helper.Log(log.LevelInfo, "key", "value")
+helper.Info("info message")
+helper.Infof("info %s", "message")
+helper.Infow("key", "value")
 ```
-
diff --git a/log/helper.go b/log/helper.go
index f2a7ad3d..2c5e67f9 100644
--- a/log/helper.go
+++ b/log/helper.go
@@ -6,79 +6,77 @@ import (
 
 // Helper is a logger helper.
 type Helper struct {
-	debug Logger
-	info  Logger
-	warn  Logger
-	err   Logger
+	logger Logger
 }
 
 // NewHelper new a logger helper.
-func NewHelper(name string, logger Logger) *Helper {
-	logger = With(logger, "module", name)
+func NewHelper(logger Logger) *Helper {
 	return &Helper{
-		debug: Debug(logger),
-		info:  Info(logger),
-		warn:  Warn(logger),
-		err:   Error(logger),
+		logger: logger,
 	}
 }
 
+// Log .
+func (h *Helper) Log(level Level, keyvals ...interface{}) {
+	h.logger.Log(level, keyvals...)
+}
+
 // Debug logs a message at debug level.
 func (h *Helper) Debug(a ...interface{}) {
-	h.debug.Log("msg", fmt.Sprint(a...))
+	h.logger.Log(LevelDebug, "msg", fmt.Sprint(a...))
 }
 
 // Debugf logs a message at debug level.
 func (h *Helper) Debugf(format string, a ...interface{}) {
-	h.debug.Log("msg", fmt.Sprintf(format, a...))
+	h.logger.Log(LevelDebug, "msg", fmt.Sprintf(format, a...))
 }
 
 // Debugw logs a message at debug level.
-func (h *Helper) Debugw(kv ...interface{}) {
-	h.debug.Log(kv...)
+func (h *Helper) Debugw(keyvals ...interface{}) {
+	h.logger.Log(LevelDebug, keyvals...)
 }
 
 // Info logs a message at info level.
 func (h *Helper) Info(a ...interface{}) {
-	h.info.Log("msg", fmt.Sprint(a...))
+	h.logger.Log(LevelInfo, "msg", fmt.Sprint(a...))
 }
 
 // Infof logs a message at info level.
 func (h *Helper) Infof(format string, a ...interface{}) {
-	h.info.Log("msg", fmt.Sprintf(format, a...))
+	h.logger.Log(LevelInfo, "msg", fmt.Sprintf(format, a...))
 }
 
 // Infow logs a message at info level.
-func (h *Helper) Infow(kv ...interface{}) {
-	h.info.Log(kv...)
+func (h *Helper) Infow(keyvals ...interface{}) {
+	h.logger.Log(LevelInfo, keyvals...)
 }
 
 // Warn logs a message at warn level.
 func (h *Helper) Warn(a ...interface{}) {
-	h.warn.Log("msg", fmt.Sprint(a...))
+	h.logger.Log(LevelWarn, "msg", fmt.Sprint(a...))
 }
 
 // Warnf logs a message at warnf level.
 func (h *Helper) Warnf(format string, a ...interface{}) {
-	h.warn.Log("msg", fmt.Sprintf(format, a...))
+	h.logger.Log(LevelWarn, "msg", fmt.Sprintf(format, a...))
 }
 
 // Warnw logs a message at warnf level.
-func (h *Helper) Warnw(kv ...interface{}) {
-	h.warn.Log(kv...)
+func (h *Helper) Warnw(keyvals ...interface{}) {
+	h.logger.Log(LevelWarn, keyvals...)
 }
 
 // Error logs a message at error level.
 func (h *Helper) Error(a ...interface{}) {
-	h.err.Log("msg", fmt.Sprint(a...))
+	h.logger.Log(LevelError, "msg", fmt.Sprint(a...))
 }
 
 // Errorf logs a message at error level.
 func (h *Helper) Errorf(format string, a ...interface{}) {
-	h.err.Log("msg", fmt.Sprintf(format, a...))
+	h.logger.Log(LevelError, "msg", fmt.Sprintf(format, a...))
 }
 
 // Errorw logs a message at error level.
-func (h *Helper) Errorw(kv ...interface{}) {
-	h.err.Log(kv...)
+func (h *Helper) Errorw(keyvals ...interface{}) {
+	h.logger.Log(LevelError, keyvals...)
 }
diff --git a/log/log.go b/log/log.go
index 79fec9c8..6a27974b 100644
--- a/log/log.go
+++ b/log/log.go
@@ -11,7 +11,7 @@ var (
 
 // Logger is a logger interface.
 type Logger interface {
-	Log(kv ...interface{}) error
+	Log(level Level, keyvals ...interface{}) error
 }
 
 type context struct {
@@ -20,15 +20,15 @@ type context struct {
 	hasValuer bool
 }
 
-func (c *context) Log(kv ...interface{}) error {
-	kvs := make([]interface{}, 0, len(c.prefix)+len(kv))
+func (c *context) Log(level Level, keyvals ...interface{}) error {
+	kvs := make([]interface{}, 0, len(c.prefix)+len(keyvals))
 	kvs = append(kvs, c.prefix...)
 	if c.hasValuer {
 		bindValues(kvs)
 	}
-	kvs = append(kvs, kv...)
+	kvs = append(kvs, keyvals...)
 	for _, l := range c.logs {
-		if err := l.Log(kvs...); err != nil {
+		if err := l.Log(level, kvs...); err != nil {
 			return err
 		}
 	}
@@ -54,23 +54,3 @@ func With(l Logger, kv ...interface{}) Logger {
 func MultiLogger(logs ...Logger) Logger {
 	return &context{logs: logs}
 }
-
-// Debug returns a debug logger.
-func Debug(log Logger) Logger {
-	return With(log, LevelKey, LevelDebug)
-}
-
-// Info returns a info logger.
-func Info(log Logger) Logger {
-	return With(log, LevelKey, LevelInfo)
-}
-
-// Warn return a warn logger.
-func Warn(log Logger) Logger {
-	return With(log, LevelKey, LevelWarn)
-}
-
-// Error returns a error logger.
-func Error(log Logger) Logger {
-	return With(log, LevelKey, LevelError)
-}
diff --git a/log/std.go b/log/std.go
index 2ecfdbf3..6b1e4c45 100644
--- a/log/std.go
+++ b/log/std.go
@@ -15,7 +15,7 @@ type stdLogger struct {
 	pool *sync.Pool
 }
 
-// NewStdLogger new a std logger with options.
+// NewStdLogger new a logger with writer.
 func NewStdLogger(w io.Writer) Logger {
 	return &stdLogger{
 		log: log.New(w, "", 0),
@@ -28,16 +28,17 @@ func NewStdLogger(w io.Writer) Logger {
 }
 
 // Log print the kv pairs log.
-func (l *stdLogger) Log(kv ...interface{}) error {
-	if len(kv) == 0 {
+func (l *stdLogger) Log(level Level, keyvals ...interface{}) error {
+	if len(keyvals) == 0 {
 		return nil
 	}
-	if len(kv)%2 != 0 {
-		kv = append(kv, "")
+	if len(keyvals)%2 != 0 {
+		keyvals = append(keyvals, "")
 	}
 	buf := l.pool.Get().(*bytes.Buffer)
-	for i := 0; i < len(kv); i += 2 {
-		fmt.Fprintf(buf, "%s=%v ", kv[i], kv[i+1])
+	buf.WriteString(level.String())
+	for i := 0; i < len(keyvals); i += 2 {
+		fmt.Fprintf(buf, " %s=%v", keyvals[i], keyvals[i+1])
 	}
 	l.log.Output(4, buf.String())
 	buf.Reset()
diff --git a/log/verbose.go b/log/verbose.go
deleted file mode 100644
index c4288418..00000000
--- a/log/verbose.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package log
-
-// Verbose is a verbose type that implements Logger Print.
-type Verbose struct {
-	log     Logger
-	level   Level
-	enabled bool
-}
-
-// NewVerbose new a verbose with level.
-func NewVerbose(log Logger, level Level) Verbose {
-	return Verbose{log: log, level: level}
-}
-
-// Enabled will return true if this log level is enabled, guarded by the value of v.
-func (v Verbose) Enabled(level Level) bool {
-	return v.level <= level
-}
-
-// V reports whether verbosity at the call site is at least the requested level.
-func (v Verbose) V(level Level) Verbose {
-	return Verbose{log: v.log, enabled: v.Enabled(level)}
-}
-
-// Log is equivalent to the Print function, guarded by the value of v.
-func (v Verbose) Log(a ...interface{}) error {
-	if v.enabled {
-		return v.log.Log(a...)
-	}
-	return nil
-}
diff --git a/middleware/logging/logging.go b/middleware/logging/logging.go
index 0224e8a2..d7968e34 100644
--- a/middleware/logging/logging.go
+++ b/middleware/logging/logging.go
@@ -15,7 +15,7 @@ import (
 
 // Server is an server logging middleware.
 func Server(l log.Logger) middleware.Middleware {
-	logger := log.NewHelper("middleware/logging", l)
+	logger := log.NewHelper(l)
 	return func(handler middleware.Handler) middleware.Handler {
 		return func(ctx context.Context, req interface{}) (interface{}, error) {
 			var (
@@ -99,7 +99,7 @@ func Server(l log.Logger) middleware.Middleware {
 
 // Client is an client logging middleware.
 func Client(l log.Logger) middleware.Middleware {
-	logger := log.NewHelper("middleware/logging", l)
+	logger := log.NewHelper(l)
 	return func(handler middleware.Handler) middleware.Handler {
 		return func(ctx context.Context, req interface{}) (interface{}, error) {
 			var (
diff --git a/middleware/recovery/recovery.go b/middleware/recovery/recovery.go
index 33b96919..0e8622ee 100644
--- a/middleware/recovery/recovery.go
+++ b/middleware/recovery/recovery.go
@@ -46,7 +46,7 @@ func Recovery(opts ...Option) middleware.Middleware {
 	for _, o := range opts {
 		o(&options)
 	}
-	logger := log.NewHelper("middleware/recovery", options.logger)
+	logger := log.NewHelper(options.logger)
 	return func(handler middleware.Handler) middleware.Handler {
 		return func(ctx context.Context, req interface{}) (reply interface{}, err error) {
 			defer func() {
diff --git a/transport/grpc/resolver/discovery/builder.go b/transport/grpc/resolver/discovery/builder.go
index f04db983..7846b5fc 100644
--- a/transport/grpc/resolver/discovery/builder.go
+++ b/transport/grpc/resolver/discovery/builder.go
@@ -46,9 +46,9 @@ func (d *builder) Build(target resolver.Target, cc resolver.ClientConn, opts res
 	r := &discoveryResolver{
 		w:      w,
 		cc:     cc,
-		log:    log.NewHelper("grpc/resolver/discovery", d.logger),
 		ctx:    ctx,
 		cancel: cancel,
+		log:    log.NewHelper(d.logger),
 	}
 	go r.watch()
 	return r, nil
diff --git a/transport/grpc/server.go b/transport/grpc/server.go
index 7e15ce5c..572df723 100644
--- a/transport/grpc/server.go
+++ b/transport/grpc/server.go
@@ -19,8 +19,6 @@ import (
 	"google.golang.org/grpc/reflection"
 )
 
-const loggerName = "transport/grpc"
-
 var _ transport.Server = (*Server)(nil)
 
 // ServerOption is gRPC server option.
@@ -50,7 +48,7 @@ func Timeout(timeout time.Duration) ServerOption {
 // Logger with server logger.
 func Logger(logger log.Logger) ServerOption {
 	return func(s *Server) {
-		s.log = log.NewHelper(loggerName, logger)
+		s.log = log.NewHelper(logger)
 	}
 }
 
@@ -88,11 +86,11 @@ func NewServer(opts ...ServerOption) *Server {
 		network: "tcp",
 		address: ":0",
 		timeout: time.Second,
-		log:     log.NewHelper(loggerName, log.DefaultLogger),
 		middleware: middleware.Chain(
 			recovery.Recovery(),
 		),
 		health: health.NewServer(),
+		log:    log.NewHelper(log.DefaultLogger),
 	}
 	for _, o := range opts {
 		o(srv)
diff --git a/transport/http/server.go b/transport/http/server.go
index b26bf601..8cc1505b 100644
--- a/transport/http/server.go
+++ b/transport/http/server.go
@@ -15,8 +15,6 @@ import (
 	"github.com/gorilla/mux"
 )
 
-const loggerName = "transport/http"
-
 var _ transport.Server = (*Server)(nil)
 
 // ServerOption is HTTP server option.
@@ -46,7 +44,7 @@ func Timeout(timeout time.Duration) ServerOption {
 // Logger with server logger.
 func Logger(logger log.Logger) ServerOption {
 	return func(s *Server) {
-		s.log = log.NewHelper(loggerName, logger)
+		s.log = log.NewHelper(logger)
 	}
 }
 
@@ -67,7 +65,7 @@ func NewServer(opts ...ServerOption) *Server {
 		network: "tcp",
 		address: ":0",
 		timeout: time.Second,
-		log:     log.NewHelper(loggerName, log.DefaultLogger),
+		log:     log.NewHelper(log.DefaultLogger),
 	}
 	for _, o := range opts {
 		o(srv)


Test patch:
diff --git a/log/helper_test.go b/log/helper_test.go
index 40a832cb..beb30c1d 100644
--- a/log/helper_test.go
+++ b/log/helper_test.go
@@ -6,16 +6,17 @@ import (
 )
 
 func TestHelper(t *testing.T) {
-	logger := With(DefaultLogger, "caller", DefaultCaller, "ts", DefaultTimestamp)
-	log := NewHelper("test", logger)
+	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
+	log := NewHelper(logger)
 
+	log.Log(LevelDebug, "msg", "test debug")
 	log.Debug("test debug")
 	log.Debugf("test %s", "debug")
 	log.Debugw("log", "test debug")
 }
 
 func TestHelperLevel(t *testing.T) {
-	log := NewHelper("test", DefaultLogger)
+	log := NewHelper(DefaultLogger)
 	log.Debug("test debug")
 	log.Info("test info")
 	log.Warn("test warn")
@@ -23,21 +24,21 @@ func TestHelperLevel(t *testing.T) {
 }
 
 func BenchmarkHelperPrint(b *testing.B) {
-	log := NewHelper("test", NewStdLogger(ioutil.Discard))
+	log := NewHelper(NewStdLogger(ioutil.Discard))
 	for i := 0; i < b.N; i++ {
 		log.Debug("test")
 	}
 }
 
 func BenchmarkHelperPrintf(b *testing.B) {
-	log := NewHelper("test", NewStdLogger(ioutil.Discard))
+	log := NewHelper(NewStdLogger(ioutil.Discard))
 	for i := 0; i < b.N; i++ {
 		log.Debugf("%s", "test")
 	}
 }
 
 func BenchmarkHelperPrintw(b *testing.B) {
-	log := NewHelper("test", NewStdLogger(ioutil.Discard))
+	log := NewHelper(NewStdLogger(ioutil.Discard))
 	for i := 0; i < b.N; i++ {
 		log.Debugw("key", "value")
 	}
diff --git a/log/log_test.go b/log/log_test.go
index 5eefd919..a320f8da 100644
--- a/log/log_test.go
+++ b/log/log_test.go
@@ -5,27 +5,16 @@ import (
 	"testing"
 )
 
-func TestLogger(t *testing.T) {
-	logger := DefaultLogger
-	Debug(logger).Log("msg", "test debug")
-	Info(logger).Log("msg", "test info")
-	Warn(logger).Log("msg", "test warn")
-	Error(logger).Log("msg", "test error")
-}
-
 func TestInfo(t *testing.T) {
 	logger := DefaultLogger
-	logger = With(logger, "caller", DefaultCaller, "ts", DefaultTimestamp)
-	infoLogger := Info(logger)
-	infoLogger.Log("key1", "value1")
-	infoLogger.Log("key2", "value2")
-	infoLogger.Log("key3", "value3")
+	logger = With(logger, "ts", DefaultTimestamp, "caller", DefaultCaller)
+	logger.Log(LevelInfo, "key1", "value1")
 }
 
 func TestWrapper(t *testing.T) {
 	out := NewStdLogger(os.Stdout)
 	err := NewStdLogger(os.Stderr)
 
-	l := With(MultiLogger(out, err), "caller", DefaultCaller, "ts", DefaultTimestamp)
-	l.Log("msg", "test")
+	l := With(MultiLogger(out, err), "ts", DefaultTimestamp, "caller", DefaultCaller)
+	l.Log(LevelInfo, "msg", "test")
 }
diff --git a/log/std_test.go b/log/std_test.go
index 1480a805..dc11b3a8 100644
--- a/log/std_test.go
+++ b/log/std_test.go
@@ -6,8 +6,8 @@ func TestStdLogger(t *testing.T) {
 	logger := DefaultLogger
 	logger = With(logger, "caller", DefaultCaller, "ts", DefaultTimestamp)
 
-	Debug(logger).Log("msg", "test debug")
-	Info(logger).Log("msg", "test info")
-	Warn(logger).Log("msg", "test warn")
-	Error(logger).Log("msg", "test error")
+	logger.Log(LevelInfo, "msg", "test debug")
+	logger.Log(LevelInfo, "msg", "test info")
+	logger.Log(LevelInfo, "msg", "test warn")
+	logger.Log(LevelInfo, "msg", "test error")
 }
diff --git a/log/value_test.go b/log/value_test.go
index c4114227..713ba7b8 100644
--- a/log/value_test.go
+++ b/log/value_test.go
@@ -4,11 +4,6 @@ import "testing"
 
 func TestValue(t *testing.T) {
 	logger := DefaultLogger
-	logger = With(logger, "caller", DefaultCaller, "ts", DefaultTimestamp)
-	logger.Log("msg", "helloworld")
-
-	Debug(logger).Log("msg", "debug value")
-	Info(logger).Log("msg", "info value")
-	Warn(logger).Log("msg", "warn value")
-	Error(logger).Log("msg", "error value")
+	logger = With(logger, "ts", DefaultTimestamp, "caller", DefaultCaller)
+	logger.Log(LevelInfo, "msg", "helloworld")
 }
diff --git a/log/verbose_test.go b/log/verbose_test.go
deleted file mode 100644
index 146149e5..00000000
--- a/log/verbose_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package log
-
-import "testing"
-
-func TestVerbose(t *testing.T) {
-	logger := With(DefaultLogger, "caller", DefaultCaller, "ts", DefaultTimestamp)
-	v := NewVerbose(logger, 20)
-
-	v.V(10).Log("foo", "bar1")
-	v.V(20).Log("foo", "bar2")
-	v.V(30).Log("foo", "bar3")
-}
diff --git a/transport/grpc/resolver/discovery/resolver_test.go b/transport/grpc/resolver/discovery/resolver_test.go
index 34748752..b1eccf02 100644
--- a/transport/grpc/resolver/discovery/resolver_test.go
+++ b/transport/grpc/resolver/discovery/resolver_test.go
@@ -45,7 +45,7 @@ func TestWatch(t *testing.T) {
 	r := &discoveryResolver{
 		w:      &testWatch{},
 		cc:     &testClientConn{te: t},
-		log:    log.NewHelper("grpc/resolver/discovery", log.DefaultLogger),
+		log:    log.NewHelper(log.DefaultLogger),
 		ctx:    ctx,
 		cancel: cancel,
 	}