ContainerImage.Pinniped/internal/controllerlib/recorder.go
Monis Khan 0674215ef3
Switch to go.uber.org/zap for JSON formatted logging
Signed-off-by: Monis Khan <mok@vmware.com>
2022-05-24 11:17:42 -04:00

29 lines
657 B
Go

// Copyright 2020 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package controllerlib
import (
"fmt"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/events"
"go.pinniped.dev/internal/plog"
)
var _ events.EventRecorder = klogRecorder{}
type klogRecorder struct{}
func (n klogRecorder) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) {
plog.Debug("recording event",
"regarding", regarding,
"related", related,
"eventtype", eventtype,
"reason", reason,
"action", action,
"message", fmt.Sprintf(note, args...),
)
}