| 40 | } |
| 41 | |
| 42 | func (p *printer) HandleEvent(event api.ContainerEvent) { |
| 43 | switch event.Type { |
| 44 | case api.ContainerEventExited: |
| 45 | if event.Restarting { |
| 46 | p.consumer.Status(event.Source, fmt.Sprintf("exited with code %d (restarting)", event.ExitCode)) |
| 47 | } else { |
| 48 | p.consumer.Status(event.Source, fmt.Sprintf("exited with code %d", event.ExitCode)) |
| 49 | } |
| 50 | case api.ContainerEventRecreated: |
| 51 | p.consumer.Status(event.Container.Labels[api.ContainerReplaceLabel], "has been recreated") |
| 52 | case api.ContainerEventLog, api.HookEventLog: |
| 53 | p.consumer.Log(event.Source, event.Line) |
| 54 | case api.ContainerEventErr: |
| 55 | p.consumer.Err(event.Source, event.Line) |
| 56 | } |
| 57 | } |