summaryrefslogtreecommitdiff
path: root/libpod/events/events.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/events/events.go')
-rw-r--r--libpod/events/events.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/libpod/events/events.go b/libpod/events/events.go
index 1745095fb..04417fd8d 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -20,6 +20,8 @@ func (et EventerType) String() string {
return "file"
case Journald:
return "journald"
+ case Memory:
+ return "memory"
case Null:
return "none"
default:
@@ -34,6 +36,8 @@ func IsValidEventer(eventer string) bool {
return true
case Journald.String():
return true
+ case Memory.String():
+ return true
case Null.String():
return true
default:
@@ -41,7 +45,7 @@ func IsValidEventer(eventer string) bool {
}
}
-// NewEvent creates a event struct and populates with
+// NewEvent creates an event struct and populates with
// the given status and time.
func NewEvent(status Status) Event {
return Event{
@@ -63,7 +67,7 @@ func (e *Event) ToJSONString() (string, error) {
return string(b), err
}
-// ToHumanReadable returns human readable event as a formatted string
+// ToHumanReadable returns human-readable event as a formatted string
func (e *Event) ToHumanReadable(truncate bool) string {
var humanFormat string
id := e.ID
@@ -90,7 +94,7 @@ func (e *Event) ToHumanReadable(truncate bool) string {
} else {
humanFormat = fmt.Sprintf("%s %s %s", e.Time, e.Type, e.Status)
}
- case Volume:
+ case Volume, Machine:
humanFormat = fmt.Sprintf("%s %s %s %s", e.Time, e.Type, e.Status, e.Name)
}
return humanFormat
@@ -99,19 +103,19 @@ func (e *Event) ToHumanReadable(truncate bool) string {
// NewEventFromString takes stringified json and converts
// it to an event
func newEventFromJSONString(event string) (*Event, error) {
- e := Event{}
- if err := json.Unmarshal([]byte(event), &e); err != nil {
+ e := new(Event)
+ if err := json.Unmarshal([]byte(event), e); err != nil {
return nil, err
}
- return &e, nil
+ return e, nil
}
-// ToString converts a Type to a string
+// String converts a Type to a string
func (t Type) String() string {
return string(t)
}
-// ToString converts a status to a string
+// String converts a status to a string
func (s Status) String() string {
return string(s)
}
@@ -123,6 +127,8 @@ func StringToType(name string) (Type, error) {
return Container, nil
case Image.String():
return Image, nil
+ case Machine.String():
+ return Machine, nil
case Network.String():
return Network, nil
case Pod.String():