mirror of
https://github.com/docker/compose.git
synced 2026-08-28 04:18:05 +00:00
pull logs and events better than aggregate events from multiple channels
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
17c26e81ff
commit
a4b003ecfa
10 changed files with 145 additions and 111 deletions
|
|
@ -65,10 +65,8 @@ type CreateOptions struct {
|
|||
|
||||
// StartOptions group options of the Start API
|
||||
type StartOptions struct {
|
||||
// Attach will attach to container and pipe stdout/stderr to LogConsumer
|
||||
Attach LogConsumer
|
||||
// Listener will get notified on container events
|
||||
Listener chan ContainerExited
|
||||
// Attach will attach to service containers and pipe stdout/stderr to channel
|
||||
Attach chan ContainerEvent
|
||||
}
|
||||
|
||||
// UpOptions group options of the Up API
|
||||
|
|
@ -185,11 +183,21 @@ type Stack struct {
|
|||
// LogConsumer is a callback to process log messages from services
|
||||
type LogConsumer interface {
|
||||
Log(service, container, message string)
|
||||
Status(service, container, message string)
|
||||
Status(service, container, msg string)
|
||||
}
|
||||
|
||||
// ContainerExited let us know a Container exited
|
||||
type ContainerExited struct {
|
||||
Service string
|
||||
Status int
|
||||
// ContainerEvent notify an event has been collected on Source container implementing Service
|
||||
type ContainerEvent struct {
|
||||
Type int
|
||||
Source string
|
||||
Service string
|
||||
Line string
|
||||
ExitCode int
|
||||
}
|
||||
|
||||
const (
|
||||
// ContainerEventLog is a ContainerEvent of type log. Line is set
|
||||
ContainerEventLog = iota
|
||||
// ContainerEventExit is a ContainerEvent of type exit. ExitCode is set
|
||||
ContainerEventExit
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue