mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
a6c8c401ff
* feat: add signal in internal cmd package Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * logger Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
22 lines
447 B
Go
22 lines
447 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")
|
|
logger.Info("setup 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
|
|
}
|