mirror of
https://github.com/containers/podman.git
synced 2025-12-06 05:37:49 +08:00
Add event logging to libpod, even display to podman
In lipod, we now log major events that occurr. These events can be displayed using the `podman events` command. Each event contains: * Type (container, image, volume, pod...) * Status (create, rm, stop, kill, ....) * Timestamp in RFC3339Nano format * Name (if applicable) * Image (if applicable) The format of the event and the varlink endpoint are to not be considered stable until cockpit has done its enablement. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package image
|
||||
|
||||
import "github.com/pkg/errors"
|
||||
import (
|
||||
"github.com/containers/libpod/libpod/events"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// GetPruneImages returns a slice of images that have no names/unused
|
||||
func (ir *Runtime) GetPruneImages(all bool) ([]*Image, error) {
|
||||
@@ -41,6 +44,7 @@ func (ir *Runtime) PruneImages(all bool) ([]string, error) {
|
||||
if err := p.Remove(true); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to prune image")
|
||||
}
|
||||
defer p.newImageEvent(events.Prune)
|
||||
prunedCids = append(prunedCids, p.ID())
|
||||
}
|
||||
return prunedCids, nil
|
||||
|
||||
Reference in New Issue
Block a user