mirror of
https://github.com/containers/podman.git
synced 2025-12-02 02:58:03 +08:00
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>
24 lines
582 B
Go
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))
|
|
}
|
|
}
|