Skip to content

Commit d96fb10

Browse files
committed
remove log flag
Signed-off-by: Mark Jagyo <[email protected]>
1 parent b6248b6 commit d96fb10

File tree

5 files changed

+10
-24
lines changed

5 files changed

+10
-24
lines changed

cmd/compose/up.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ type upOptions struct {
5858
noAttach []string
5959
timestamp bool
6060
wait bool
61-
log bool
6261
waitTimeout int
6362
watch bool
6463
navigationMenu bool
@@ -172,7 +171,6 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *Backend
172171
flags.StringArrayVar(&up.noAttach, "no-attach", []string{}, "Do not attach (stream logs) to the specified services")
173172
flags.BoolVar(&up.attachDependencies, "attach-dependencies", false, "Automatically attach to log output of dependent services")
174173
flags.BoolVar(&up.wait, "wait", false, "Wait for services to be running|healthy. Implies attached mode by default.")
175-
flags.BoolVar(&up.log, "log", false, "Stream service logs")
176174
flags.IntVar(&up.waitTimeout, "wait-timeout", 0, "Maximum duration in seconds to wait for the project to be running|healthy")
177175
flags.BoolVarP(&up.watch, "watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.")
178176
flags.BoolVar(&up.navigationMenu, "menu", false, "Enable interactive shortcuts when running attached. Incompatible with --detach. Can also be enable/disable by setting COMPOSE_MENU environment var.")
@@ -197,12 +195,6 @@ func validateFlags(up *upOptions, create *createOptions) error {
197195
return fmt.Errorf("--abort-on-container-failure cannot be combined with --abort-on-container-exit")
198196
}
199197

200-
if up.log {
201-
if !up.wait {
202-
return fmt.Errorf("--log should be combined with --wait")
203-
}
204-
}
205-
206198
if up.wait {
207199
up.Detach = false
208200
if up.attachDependencies || up.cascadeStop || len(up.attach) > 0 {
@@ -348,7 +340,6 @@ func runUp(
348340
OnExit: upOptions.OnExit(),
349341
Wait: upOptions.wait,
350342
WaitTimeout: timeout,
351-
Log: upOptions.log,
352343
Watch: upOptions.watch,
353344
Services: services,
354345
NavigationMenu: upOptions.navigationMenu && display.Mode != "plain" && dockerCli.In().IsTerminal(),

cmd/compose/wait.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ func waitCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *Backe
6060
}
6161

6262
cmd.Flags().BoolVar(&opts.downProject, "down-project", false, "Drops project when the first container stops")
63-
cmd.Flags().BoolVar(&opts.log, "log", false, "Shows the logs of the service")
6463

6564
return cmd
6665
}
@@ -81,7 +80,6 @@ func runWait(ctx context.Context, dockerCli command.Cli, backendOptions *Backend
8180
Services: opts.services,
8281
DownProjectOnContainerExit: opts.downProject,
8382
Consumer: consumer,
84-
Log: opts.log,
8583
Project: project,
8684
})
8785
}

pkg/api/api.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ type WaitOptions struct {
165165
Services []string
166166
// Executes a down when a container exits
167167
DownProjectOnContainerExit bool
168-
Log bool
169168
Project *types.Project
170169
Consumer LogConsumer
171170
}
@@ -296,7 +295,6 @@ type StartOptions struct {
296295
ExitCodeFrom string
297296
// Wait won't return until containers reached the running|healthy state
298297
Wait bool
299-
Log bool
300298
WaitTimeout time.Duration
301299
// Services passed in the command line to be started
302300
Services []string

pkg/compose/up.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,11 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
198198
}
199199
monitor.withListener(printer.HandleEvent)
200200

201-
monitor.withListener(onHealthy(func(e api.ContainerEvent) {
202-
fmt.Println("Healthy:", e.Service, e.Container.Name)
203-
cancel()
204-
}))
201+
if options.Start.Wait {
202+
monitor.withListener(onHealthy(func(e api.ContainerEvent) {
203+
cancel()
204+
}))
205+
}
205206

206207
var exitCode int
207208
if options.Start.OnExit != api.CascadeIgnore {

pkg/compose/wait.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ func (s *composeService) Wait(
4242
eg, waitCtx := errgroup.WithContext(ctx)
4343
var statusCode int64
4444

45-
if options.Log {
46-
s.Logs(ctx, projectName, options.Consumer, api.LogOptions{
47-
Project: options.Project,
48-
Services: options.Services,
49-
Follow: false,
50-
})
51-
}
45+
s.Logs(ctx, projectName, options.Consumer, api.LogOptions{
46+
Project: options.Project,
47+
Services: options.Services,
48+
Follow: false,
49+
})
5250

5351
for _, ctr := range containers {
5452
eg.Go(func() error {

0 commit comments

Comments
 (0)