Skip to content

Commit 8e37369

Browse files
authored
fix: set logger for controller-runtime (#1211)
Signed-off-by: Xiaodong Ye <[email protected]>
1 parent 2a8a9b4 commit 8e37369

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ require (
3838
github.com/IBM/watsonx-go v1.0.1
3939
github.com/aws/aws-sdk-go v1.53.21
4040
github.com/cohere-ai/cohere-go/v2 v2.7.3
41+
github.com/go-logr/zapr v1.3.0
4142
github.com/google/generative-ai-go v0.11.0
4243
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
4344
github.com/hupe1980/go-huggingface v0.0.15

pkg/server/server.go

+4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ import (
2525

2626
gw "buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2/schema/v1/server-service/schemav1gateway"
2727
rpc "buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go/schema/v1/schemav1grpc"
28+
"github.com/go-logr/zapr"
2829
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
2930
"github.com/prometheus/client_golang/prometheus/promhttp"
3031
"go.uber.org/zap"
3132
"golang.org/x/net/http2"
3233
"golang.org/x/net/http2/h2c"
34+
ctrl "sigs.k8s.io/controller-runtime"
3335

3436
"google.golang.org/grpc"
3537
"google.golang.org/grpc/credentials/insecure"
@@ -80,6 +82,8 @@ func grpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Ha
8082
}
8183

8284
func (s *Config) Serve() error {
85+
ctrl.SetLogger(zapr.NewLogger(s.Logger))
86+
8387
var lis net.Listener
8488
var err error
8589
address := fmt.Sprintf(":%s", s.Port)

0 commit comments

Comments
 (0)