Files
podman/libpod/events/events_linux.go
ksw2000 e4e7bc41f3 refact: EventerType and improve consistency
1. Completed the EventerType comment.
2. Changed EventerType to be represented as a string.
3. Since EventerType is designed to be entirely lowercase, changed the comparison to use lowercase instead of uppercase.
4. Renamed newEventJournalD to newJournalDEventer.
5. Removed redundant error-checking steps in events_linux.go.

Signed-off-by: ksw2000 <13825170+ksw2000@users.noreply.github.com>
2024-11-25 08:52:53 +00:00

24 lines
582 B
Go

package events
import (
"fmt"
"strings"
"github.com/sirupsen/logrus"
)
// NewEventer creates an eventer based on the eventer type
func NewEventer(options EventerOptions) (Eventer, error) {
logrus.Debugf("Initializing event backend %s", options.EventerType)
switch EventerType(strings.ToLower(options.EventerType)) {
case Journald:
return newJournalDEventer(options)
case LogFile:
return newLogFileEventer(options)
case Null:
return newNullEventer(), nil
default:
return nil, fmt.Errorf("unknown event logger type: %s", strings.ToLower(options.EventerType))
}
}