Skip to content

Commit

Permalink
Merge pull request etcd-io#15661 from ahrtr/backport_15447_20230407
Browse files Browse the repository at this point in the history
[3.5] etcdserver: set zap logging to wsproxy
  • Loading branch information
serathius authored and tjungblu committed Jul 26, 2023
2 parents 0d5588c + 3c837d7 commit 8e6355a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions server/embed/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,18 @@ func (sctx *serveCtx) registerGateway(dial func(ctx context.Context) (*grpc.Clie
return gwmux, nil
}

type wsProxyZapLogger struct {
*zap.Logger
}

func (w wsProxyZapLogger) Warnln(i ...interface{}) {
w.Warn(fmt.Sprint(i...))
}

func (w wsProxyZapLogger) Debugln(i ...interface{}) {
w.Debug(fmt.Sprint(i...))
}

func (sctx *serveCtx) createMux(gwmux *gw.ServeMux, handler http.Handler) *http.ServeMux {
httpmux := http.NewServeMux()
for path, h := range sctx.userHandlers {
Expand All @@ -342,6 +354,7 @@ func (sctx *serveCtx) createMux(gwmux *gw.ServeMux, handler http.Handler) *http.
},
),
wsproxy.WithMaxRespBodyBufferSize(0x7fffffff),
wsproxy.WithLogger(wsProxyZapLogger{sctx.lg}),
),
)
}
Expand Down

0 comments on commit 8e6355a

Please sign in to comment.