Signed-off-by: Drew Erny <drew.erny@docker.com>
| ... | ... |
@@ -23,11 +23,10 @@ import ( |
| 23 | 23 |
type logsOptions struct {
|
| 24 | 24 |
noResolve bool |
| 25 | 25 |
noTrunc bool |
| 26 |
- noIDs bool |
|
| 26 |
+ noTaskIDs bool |
|
| 27 | 27 |
follow bool |
| 28 | 28 |
since string |
| 29 | 29 |
timestamps bool |
| 30 |
- details bool |
|
| 31 | 30 |
tail string |
| 32 | 31 |
|
| 33 | 32 |
service string |
| ... | ... |
@@ -50,11 +49,10 @@ func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
| 50 | 50 |
flags := cmd.Flags() |
| 51 | 51 |
flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names") |
| 52 | 52 |
flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output") |
| 53 |
- flags.BoolVar(&opts.noIDs, "no-ids", false, "Do not include task IDs") |
|
| 53 |
+ flags.BoolVar(&opts.noTaskIDs, "no-task-ids", false, "Do not include task IDs") |
|
| 54 | 54 |
flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") |
| 55 | 55 |
flags.StringVar(&opts.since, "since", "", "Show logs since timestamp") |
| 56 | 56 |
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") |
| 57 |
- flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") |
|
| 58 | 57 |
flags.StringVar(&opts.tail, "tail", "all", "Number of lines to show from the end of the logs") |
| 59 | 58 |
return cmd |
| 60 | 59 |
} |
| ... | ... |
@@ -69,7 +67,6 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
| 69 | 69 |
Timestamps: opts.timestamps, |
| 70 | 70 |
Follow: opts.follow, |
| 71 | 71 |
Tail: opts.tail, |
| 72 |
- Details: opts.details, |
|
| 73 | 72 |
} |
| 74 | 73 |
|
| 75 | 74 |
client := dockerCli.Client() |
| ... | ... |
@@ -86,10 +83,12 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
| 86 | 86 |
defer responseBody.Close() |
| 87 | 87 |
|
| 88 | 88 |
var replicas uint64 |
| 89 |
+ padding := 1 |
|
| 89 | 90 |
if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil {
|
| 91 |
+ // if replicas are initialized, figure out if we need to pad them |
|
| 90 | 92 |
replicas = *service.Spec.Mode.Replicated.Replicas |
| 93 |
+ padding = len(strconv.FormatUint(replicas, 10)) |
|
| 91 | 94 |
} |
| 92 |
- padding := len(strconv.FormatUint(replicas, 10)) |
|
| 93 | 95 |
|
| 94 | 96 |
taskFormatter := newTaskFormatter(client, opts, padding) |
| 95 | 97 |
|
| ... | ... |
@@ -141,7 +140,7 @@ func (f *taskFormatter) format(ctx context.Context, logCtx logContext) (string, |
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 | 143 |
taskName := fmt.Sprintf("%s.%d", serviceName, task.Slot)
|
| 144 |
- if !f.opts.noIDs {
|
|
| 144 |
+ if !f.opts.noTaskIDs {
|
|
| 145 | 145 |
if f.opts.noTrunc {
|
| 146 | 146 |
taskName += fmt.Sprintf(".%s", task.ID)
|
| 147 | 147 |
} else {
|