2023-03-21 17:45:14 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-06-23 00:33:17 +00:00
|
|
|
"context"
|
|
|
|
|
2023-09-13 15:41:45 +00:00
|
|
|
"github.com/containerd/log"
|
2023-03-21 17:45:14 +00:00
|
|
|
"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() {
|
2023-06-23 00:33:17 +00:00
|
|
|
l := log.G(context.TODO()).WithField("library", "grpc")
|
2023-09-15 11:51:51 +00:00
|
|
|
grpclog.SetLoggerV2(grpclog.NewLoggerV2(l.WriterLevel(log.TraceLevel), l.WriterLevel(log.DebugLevel), l.WriterLevel(log.WarnLevel)))
|
2023-03-21 17:45:14 +00:00
|
|
|
}
|