diff --git a/command/service/logs.go b/command/service/logs.go index cfcb7ed105..30ed504cfa 100644 --- a/command/service/logs.go +++ b/command/service/logs.go @@ -42,20 +42,22 @@ func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command { var opts logsOptions cmd := &cobra.Command{ - Use: "logs [OPTIONS] SERVICE", - Short: "Fetch the logs of a service", + Use: "logs [OPTIONS] SERVICE|TASK", + Short: "Fetch the logs of a service or task", Args: cli.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.target = args[0] return runLogs(dockerCli, &opts) }, - Tags: map[string]string{"experimental": ""}, + Tags: map[string]string{"version": "1.29"}, } flags := cmd.Flags() + // options specific to service logs flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names in output") flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") flags.BoolVar(&opts.noTaskIDs, "no-task-ids", false, "Do not include task IDs in output") + // options identical to container logs flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)") flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") @@ -94,6 +96,8 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error { tty = task.Spec.ContainerSpec.TTY // TODO(dperny) hot fix until we get a nice details system squared away, // ignores details (including task context) if we have a TTY log + // if we don't do this, we'll vomit the huge context verbatim into the + // TTY log lines and that's Undesirable. if tty { options.Details = false }