Support SetStructuredLogging with the new events library

Kubernetes-commit: 230cb00ddd989ae2359696f6aa09a71253936a49
This commit is contained in:
shawnhanx
2021-10-11 16:16:46 +08:00
committed by Kubernetes Publisher
parent 3511ef41b1
commit 93595145a2
2 changed files with 19 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import (
eventsv1 "k8s.io/api/events/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
)
// EventRecorder knows how to record events on behalf of an EventSource.
@@ -56,6 +57,10 @@ type EventBroadcaster interface {
// TODO: figure out if this can be removed.
StartEventWatcher(eventHandler func(event runtime.Object)) func()
// StartStructuredLogging starts sending events received from this EventBroadcaster to the structured
// logging function. The return value can be ignored or used to stop recording, if desired.
StartStructuredLogging(verbosity klog.Level) func()
// Shutdown shuts down the broadcaster
Shutdown()
}