2020-09-16 14:19:51 +00:00
|
|
|
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2020-08-28 15:59:09 +00:00
|
|
|
|
|
|
|
package controllerlib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
"k8s.io/client-go/tools/events"
|
2022-04-16 02:43:53 +00:00
|
|
|
|
|
|
|
"go.pinniped.dev/internal/plog"
|
2020-08-28 15:59:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ events.EventRecorder = klogRecorder{}
|
|
|
|
|
|
|
|
type klogRecorder struct{}
|
|
|
|
|
|
|
|
func (n klogRecorder) Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...interface{}) {
|
2022-04-16 02:43:53 +00:00
|
|
|
plog.Debug("recording event",
|
2020-08-28 15:59:09 +00:00
|
|
|
"regarding", regarding,
|
|
|
|
"related", related,
|
|
|
|
"eventtype", eventtype,
|
|
|
|
"reason", reason,
|
|
|
|
"action", action,
|
|
|
|
"message", fmt.Sprintf(note, args...),
|
|
|
|
)
|
|
|
|
}
|