Files
moby/daemon/command/grpclog.go
Derek McGowan 33139da522 Split part of dockerd main to command under daemon
Allows using daemon/internal packages when creating dockerd

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:03 -07:00

20 lines
588 B
Go

package command
import (
"context"
"github.com/containerd/log"
"google.golang.org/grpc/grpclog"
)
// grpc's default logger is *very* noisy and uses "info" and even "warn" level logging for mostly useless messages.
// This function configures the grpc logger to step down the severity of all messages.
//
// info => trace
// warn => debug
// error => warn
func configureGRPCLog(ctx context.Context) {
l := log.G(ctx).WithField("library", "grpc")
grpclog.SetLoggerV2(grpclog.NewLoggerV2(l.WriterLevel(log.TraceLevel), l.WriterLevel(log.DebugLevel), l.WriterLevel(log.WarnLevel)))
}