(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts logsOptions, services []string)
| 78 | } |
| 79 | |
| 80 | func runLogs(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts logsOptions, services []string) error { |
| 81 | project, name, err := opts.projectOrName(ctx, dockerCli, services...) |
| 82 | if err != nil { |
| 83 | return err |
| 84 | } |
| 85 | |
| 86 | // exclude services configured to ignore output (attach: false), until explicitly selected |
| 87 | if project != nil && len(services) == 0 { |
| 88 | for n, service := range project.Services { |
| 89 | if service.Attach == nil || *service.Attach { |
| 90 | services = append(services, n) |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | consumer := formatter.NewLogConsumer(ctx, dockerCli.Out(), dockerCli.Err(), !opts.noColor, !opts.noPrefix, false) |
| 100 | return backend.Logs(ctx, name, consumer, api.LogOptions{ |
| 101 | Project: project, |
| 102 | Services: services, |
| 103 | Follow: opts.follow, |
| 104 | Index: opts.index, |
| 105 | Tail: opts.tail, |
| 106 | Since: opts.since, |
| 107 | Until: opts.until, |
| 108 | Timestamps: opts.timestamps, |
| 109 | }) |
| 110 | } |
| 111 | |
| 112 | var _ api.LogConsumer = &logConsumer{} |
| 113 |
no test coverage detected