Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/compose/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func logsCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *Backe
flags := logsCmd.Flags()
flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output")
flags.IntVar(&opts.index, "index", 0, "index of the container if service has multiple replicas")
flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
flags.StringVar(&opts.until, "until", "", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --since`.")
flags.StringVar(&opts.until, "until", "", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --until`.")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add this all in the flag description? I think we could have some alternatives here; if we add an Examples header in the markdown, and a header that has the right anchor, the docs should create a link to the flag description (similar to https://github.com/docker/cli/blob/v29.5.2/docs/reference/commandline/container_logs.md)

An alternative is to set the ExternalURL annotation; that would allow the docs to link to an alternative URL, which can be pointing to the corresponding flag for docker container logs;
https://github.com/docker/cli-docs-tool/blob/7543983fe39fcedd9182dfbee8824375999f8add/annotation/annotation.go#L19-L20

For an example, see https://github.com/docker/cli/blob/ad776d1e107b0d1cb3559a9c6b6391e11c3c51de/cli/command/image/build.go#L118-L119

	flags.Var(&options.buildArgs, "build-arg", "Set build-time variables")
	flags.SetAnnotation("build-arg", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/buildx/build/#build-arg"})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we still have work to do on the CLI documentation for the accepted formats though https://docs.docker.com/reference/cli/docker/container/logs/#until

(I recall there were some formats that worked, but not intentional, so we need to a tread carefully which formats we want to document).

flags.BoolVar(&opts.noColor, "no-color", false, "Produce monochrome output")
flags.BoolVar(&opts.noPrefix, "no-log-prefix", false, "Don't print prefix in logs")
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps")
Expand Down
22 changes: 11 additions & 11 deletions docs/reference/compose_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Displays log output from services

### Options

| Name | Type | Default | Description |
|:---------------------|:---------|:--------|:-----------------------------------------------------------------------------------------------|
| `--dry-run` | `bool` | | Execute command in dry run mode |
| `-f`, `--follow` | `bool` | | Follow log output |
| `--index` | `int` | `0` | index of the container if service has multiple replicas |
| `--no-color` | `bool` | | Produce monochrome output |
| `--no-log-prefix` | `bool` | | Don't print prefix in logs |
| `--since` | `string` | | Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) |
| `-n`, `--tail` | `string` | `all` | Number of lines to show from the end of the logs for each container |
| `-t`, `--timestamps` | `bool` | | Show timestamps |
| `--until` | `string` | | Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) |
| Name | Type | Default | Description |
|:---------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--dry-run` | `bool` | | Execute command in dry run mode |
| `-f`, `--follow` | `bool` | | Follow log output |
| `--index` | `int` | `0` | index of the container if service has multiple replicas |
| `--no-color` | `bool` | | Produce monochrome output |
| `--no-log-prefix` | `bool` | | Don't print prefix in logs |
| `--since` | `string` | | Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --since`. |
| `-n`, `--tail` | `string` | `all` | Number of lines to show from the end of the logs for each container |
| `-t`, `--timestamps` | `bool` | | Show timestamps |
| `--until` | `string` | | Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --until`. |


<!---MARKER_GEN_END-->
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/docker_compose_logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ options:
- option: since
value_type: string
description: |
Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --since`.
deprecated: false
hidden: false
experimental: false
Expand Down Expand Up @@ -82,7 +82,7 @@ options:
- option: until
value_type: string
description: |
Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes). Accepts the same formats as `docker container logs --until`.
deprecated: false
hidden: false
experimental: false
Expand Down
Loading