1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

Bump to k8s 1.25-rc.0

This commit is contained in:
JaneLiuL
2022-08-18 09:11:02 +08:00
committed by Amir Alavi
parent 1eade5bf91
commit c9b0fbe467
967 changed files with 35722 additions and 35029 deletions

View File

@@ -54,6 +54,8 @@ limitations under the License.
package zapr
import (
"fmt"
"github.com/go-logr/logr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
@@ -170,11 +172,21 @@ func zapIt(field string, val interface{}) zap.Field {
// Handle types that implement logr.Marshaler: log the replacement
// object instead of the original one.
if marshaler, ok := val.(logr.Marshaler); ok {
val = marshaler.MarshalLog()
field, val = invokeMarshaler(field, marshaler)
}
return zap.Any(field, val)
}
func invokeMarshaler(field string, m logr.Marshaler) (f string, ret interface{}) {
defer func() {
if r := recover(); r != nil {
ret = fmt.Sprintf("PANIC=%s", r)
f = field + "Error"
}
}()
return field, m.MarshalLog()
}
func (zl *zapLogger) Init(ri logr.RuntimeInfo) {
zl.l = zl.l.WithOptions(zap.AddCallerSkip(ri.CallDepth))
}