mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-08 10:47:26 +00:00
Merge pull request #91712 from KobayashiD27/structured-logging-in-event
Migrate log to klog.InfoS for staging/src/k8s.io/client-go Kubernetes-commit: 00d6255f440f4513dfaafaf6c0d0206ab9e9bd22
This commit is contained in:
commit
e0abfaa8ef
@ -121,6 +121,10 @@ type EventBroadcaster interface {
|
|||||||
// function. The return value can be ignored or used to stop recording, if desired.
|
// function. The return value can be ignored or used to stop recording, if desired.
|
||||||
StartLogging(logf func(format string, args ...interface{})) watch.Interface
|
StartLogging(logf func(format string, args ...interface{})) watch.Interface
|
||||||
|
|
||||||
|
// 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) watch.Interface
|
||||||
|
|
||||||
// NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster
|
// NewRecorder returns an EventRecorder that can be used to send events to this EventBroadcaster
|
||||||
// with the event source set to the given event source.
|
// with the event source set to the given event source.
|
||||||
NewRecorder(scheme *runtime.Scheme, source v1.EventSource) EventRecorder
|
NewRecorder(scheme *runtime.Scheme, source v1.EventSource) EventRecorder
|
||||||
@ -279,6 +283,15 @@ func (e *eventBroadcasterImpl) StartLogging(logf func(format string, args ...int
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
func (e *eventBroadcasterImpl) StartStructuredLogging(verbosity klog.Level) watch.Interface {
|
||||||
|
return e.StartEventWatcher(
|
||||||
|
func(e *v1.Event) {
|
||||||
|
klog.V(verbosity).InfoS("Event occurred", "object", klog.KRef(e.InvolvedObject.Namespace, e.InvolvedObject.Name), "kind", e.InvolvedObject.Kind, "apiVersion", e.InvolvedObject.APIVersion, "type", e.Type, "reason", e.Reason, "message", e.Message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// StartEventWatcher starts sending events received from this EventBroadcaster to the given event handler function.
|
// StartEventWatcher starts sending events received from this EventBroadcaster to the given event handler function.
|
||||||
// The return value can be ignored or used to stop recording, if desired.
|
// The return value can be ignored or used to stop recording, if desired.
|
||||||
func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(*v1.Event)) watch.Interface {
|
func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(*v1.Event)) watch.Interface {
|
||||||
|
Loading…
Reference in New Issue
Block a user