github.com/bdwilliams/libcompose@v0.3.1-0.20160826154243-d81a9bdacff0/project/project_events.go (about)

     1  package project
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/docker/libcompose/project/events"
     7  )
     8  
     9  // Events listen for real time events from containers (of the project).
    10  func (p *Project) Events(ctx context.Context, services ...string) (chan events.ContainerEvent, error) {
    11  	events := make(chan events.ContainerEvent)
    12  	if len(services) == 0 {
    13  		services = p.ServiceConfigs.Keys()
    14  	}
    15  	// FIXME(vdemeester) handle errors (chan) here
    16  	for _, service := range services {
    17  		s, err := p.CreateService(service)
    18  		if err != nil {
    19  			return nil, err
    20  		}
    21  		go s.Events(ctx, events)
    22  	}
    23  	return events, nil
    24  }