From 49893305b4736587cec9401ef30a4597a41b2438 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 8 Nov 2021 22:06:25 +0000 Subject: [PATCH] Only turn on response log in grpc in trace mode --- app.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.go b/app.go index 89d605cb..c2260627 100644 --- a/app.go +++ b/app.go @@ -26,6 +26,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/philip-bui/grpc-zerolog" + zl "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/soheilhy/cmux" ginprometheus "github.com/zsais/go-gin-prometheus" @@ -480,6 +481,12 @@ func (h *Headscale) Serve() error { WriteTimeout: 0, } + if zl.GlobalLevel() == zl.TraceLevel { + zerolog.RespLog = true + } else { + zerolog.RespLog = false + } + grpcOptions := []grpc.ServerOption{ grpc.UnaryInterceptor( grpc_middleware.ChainUnaryServer(