aboutsummaryrefslogtreecommitdiff
path: root/libpod/events/events_linux.go
blob: ffb100be82fcd816ad4603443242407de05743d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package events

import (
	"strings"

	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)

// NewEventer creates an eventer based on the eventer type
func NewEventer(options EventerOptions) (eventer Eventer, err error) {
	logrus.Debugf("Initializing event backend %s", options.EventerType)
	switch strings.ToUpper(options.EventerType) {
	case strings.ToUpper(Journald.String()):
		eventer, err = newEventJournalD(options)
		if err != nil {
			return nil, errors.Wrapf(err, "eventer creation")
		}
	case strings.ToUpper(LogFile.String()):
		eventer = EventLogFile{options}
	case strings.ToUpper(Null.String()):
		eventer = NewNullEventer()
	default:
		return nil, errors.Errorf("unknown event logger type: %s", strings.ToUpper(options.EventerType))
	}
	return eventer, nil
}