Merge pull request #32462 from dperny/service-logs-general-availability

Remove experimental from service logs
This commit is contained in:
Victor Vieux 2017-04-10 18:30:20 -07:00 committed by GitHub
commit 7a0d2dbcc2
1 changed files with 7 additions and 3 deletions

View File

@ -42,20 +42,22 @@ func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts logsOptions var opts logsOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "logs [OPTIONS] SERVICE", Use: "logs [OPTIONS] SERVICE|TASK",
Short: "Fetch the logs of a service", Short: "Fetch the logs of a service or task",
Args: cli.ExactArgs(1), Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
opts.target = args[0] opts.target = args[0]
return runLogs(dockerCli, &opts) return runLogs(dockerCli, &opts)
}, },
Tags: map[string]string{"experimental": ""}, Tags: map[string]string{"version": "1.29"},
} }
flags := cmd.Flags() 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.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.noTrunc, "no-trunc", false, "Do not truncate output")
flags.BoolVar(&opts.noTaskIDs, "no-task-ids", false, "Do not include task IDs in 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.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.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") 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 tty = task.Spec.ContainerSpec.TTY
// TODO(dperny) hot fix until we get a nice details system squared away, // TODO(dperny) hot fix until we get a nice details system squared away,
// ignores details (including task context) if we have a TTY log // 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 { if tty {
options.Details = false options.Details = false
} }