consumer: only defer debug log if debugging
@@ -185,6 +185,7 @@ func (cl *Client) PollFetches(ctx context.Context) Fetches {
var fetches Fetches
+ if cl.cfg.logger.Level() >= LogLevelDebug {
defer func() {
if len(fetches) > 0 {
toppars := make(map[int32][2]int64)
@@ -201,6 +202,7 @@ func (cl *Client) PollFetches(ctx context.Context) Fetches {
cl.cfg.logger.Log(LogLevelDebug, "returning fetch", "part_stop_start", toppars)
}
}()
+ }
fill := func() {
c.sourcesReadyMu.Lock()
