1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/cmd/internal/maxprocs.go
Charles-Edouard Brétéché 4bdd45c0cc
refactor: introduce cmd internal package (#5404)
* refactor: introduce cmd internal package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* changelog

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* informer

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* tracing

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix flag

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-18 22:21:15 +08:00

21 lines
413 B
Go

package internal
import (
"fmt"
"github.com/go-logr/logr"
"go.uber.org/automaxprocs/maxprocs"
)
func SetupMaxProcs(logger logr.Logger) func() {
logger = logger.WithName("maxprocs")
undo, err := maxprocs.Set(
maxprocs.Logger(
func(format string, args ...interface{}) {
logger.Info(fmt.Sprintf(format, args...))
},
),
)
checkError(logger, err, "failed to configure maxprocs")
return undo
}