github.com/rish1988/moby@v25.0.2+incompatible/cmd/dockerd/grpclog.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/containerd/log"
     7  	"google.golang.org/grpc/grpclog"
     8  )
     9  
    10  // grpc's default logger is *very* noisy and uses "info" and even "warn" level logging for mostly useless messages.
    11  // This function configures the grpc logger to step down the severity of all messages.
    12  //
    13  // info => trace
    14  // warn => debug
    15  // error => warn
    16  func configureGRPCLog() {
    17  	l := log.G(context.TODO()).WithField("library", "grpc")
    18  	grpclog.SetLoggerV2(grpclog.NewLoggerV2(l.WriterLevel(log.TraceLevel), l.WriterLevel(log.DebugLevel), l.WriterLevel(log.WarnLevel)))
    19  }