github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/libpod/events/events_linux.go (about) 1 package events 2 3 import ( 4 "strings" 5 6 "github.com/pkg/errors" 7 "github.com/sirupsen/logrus" 8 ) 9 10 // NewEventer creates an eventer based on the eventer type 11 func NewEventer(options EventerOptions) (eventer Eventer, err error) { 12 logrus.Debugf("Initializing event backend %s", options.EventerType) 13 switch strings.ToUpper(options.EventerType) { 14 case strings.ToUpper(Journald.String()): 15 eventer, err = newEventJournalD(options) 16 if err != nil { 17 return nil, errors.Wrapf(err, "eventer creation") 18 } 19 case strings.ToUpper(LogFile.String()): 20 eventer = EventLogFile{options} 21 case strings.ToUpper(Null.String()): 22 eventer = NewNullEventer() 23 default: 24 return nil, errors.Errorf("unknown event logger type: %s", strings.ToUpper(options.EventerType)) 25 } 26 return eventer, nil 27 }