MCPcopy
hub / github.com/docker/compose / runLogs

Function runLogs

cmd/compose/logs.go:80–110  ·  cmd/compose/logs.go::runLogs
(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts logsOptions, services []string)

Source from the content-addressed store, hash-verified

78}
79
80func 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
112var _ api.LogConsumer = &logConsumer{}
113

Callers 1

logsCommandFunction · 0.85

Calls 6

NewComposeServiceFunction · 0.92
NewLogConsumerFunction · 0.92
projectOrNameMethod · 0.80
ErrMethod · 0.65
LogsMethod · 0.65
OutMethod · 0.45

Tested by

no test coverage detected