mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Adding a LogEmit in event.go.
This creates a single function that logs a warning in case of an error. PiperOrigin-RevId: 491777874
This commit is contained in:
committed by
gVisor bot
parent
a7abe022ca
commit
50f04e5aac
@@ -54,6 +54,16 @@ func Emit(msg proto.Message) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// LogEmit is a helper method that calls DefaultEmitter.Emit.
|
||||
// It also logs a warning message when an error occurs.
|
||||
func LogEmit(msg proto.Message) error {
|
||||
_, err := DefaultEmitter.Emit(msg)
|
||||
if err != nil {
|
||||
log.Warningf("unable to emit event: %s", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// AddEmitter is a helper method that calls DefaultEmitter.AddEmitter.
|
||||
func AddEmitter(e Emitter) {
|
||||
DefaultEmitter.AddEmitter(e)
|
||||
|
||||
Reference in New Issue
Block a user