Files
podman/libpod/events/nullout.go
Kir Kolyshkin 6b1033eaa0 libpod/events: refactor to eliminate unused code
Shuffle the code around to eliminate "unused" warnings when linting
with various GOOS and build tags.

The only change in functionality should be that now NewEventer
returns ErrNoJournaldLogging (rather than "unknown event logger type")
on freebsd when journald is requested.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00

26 lines
572 B
Go

package events
import (
"context"
"errors"
)
// EventToNull is an eventer type that does nothing.
// It is meant for unit tests only
type EventToNull struct{}
// Write eats the event and always returns nil
func (e EventToNull) Write(ee Event) error {
return nil
}
// Read does nothing and returns an error.
func (e EventToNull) Read(ctx context.Context, options ReadOptions) error {
return errors.New("cannot read events with the \"none\" backend")
}
// String returns a string representation of the logger
func (e EventToNull) String() string {
return "none"
}