Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit bbaccb4

Browse files
author
Afshin Paydar
committed
Add docker compose logs --until option
Signed-off-by: Afshin Paydar <[email protected]>
1 parent 3976abc commit bbaccb4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

api/compose/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ type LogOptions struct {
325325
Services []string
326326
Tail string
327327
Since string
328+
Until string
328329
Follow bool
329330
Timestamps bool
330331
}

cli/cmd/compose/logs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type logsOptions struct {
3333
follow bool
3434
tail string
3535
since string
36+
until string
3637
noColor bool
3738
noPrefix bool
3839
timestamps bool
@@ -51,7 +52,8 @@ func logsCommand(p *projectOptions, contextType string, backend compose.Service)
5152
}
5253
flags := logsCmd.Flags()
5354
flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output.")
54-
flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37 or 42m)")
55+
flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
56+
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)")
5557
flags.BoolVar(&opts.noColor, "no-color", false, "Produce monochrome output.")
5658
flags.BoolVar(&opts.noPrefix, "no-log-prefix", false, "Don't print prefix in logs.")
5759
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps.")
@@ -73,6 +75,7 @@ func runLogs(ctx context.Context, backend compose.Service, opts logsOptions, ser
7375
Follow: opts.follow,
7476
Tail: opts.tail,
7577
Since: opts.since,
78+
Until: opts.until,
7679
Timestamps: opts.timestamps,
7780
})
7881
}

local/compose/logs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (s *composeService) Logs(ctx context.Context, projectName string, consumer
4949
ShowStderr: true,
5050
Follow: options.Follow,
5151
Since: options.Since,
52+
Until: options.Until,
5253
Tail: options.Tail,
5354
Timestamps: options.Timestamps,
5455
})

0 commit comments

Comments
 (0)