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

Commit 9ea051f

Browse files
authored
Merge pull request #1791 from afshinpaydar-binary/docker_compose_logs_since_option
2 parents ea46924 + df6d709 commit 9ea051f

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

cmd/compose/logs.go

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type logsOptions struct {
3232
composeOptions
3333
follow bool
3434
tail string
35+
since string
36+
until string
3537
noColor bool
3638
noPrefix bool
3739
timestamps bool
@@ -50,6 +52,8 @@ func logsCommand(p *projectOptions, contextType string, backend api.Service) *co
5052
}
5153
flags := logsCmd.Flags()
5254
flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output.")
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)")
5357
flags.BoolVar(&opts.noColor, "no-color", false, "Produce monochrome output.")
5458
flags.BoolVar(&opts.noPrefix, "no-log-prefix", false, "Don't print prefix in logs.")
5559
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps.")
@@ -70,6 +74,8 @@ func runLogs(ctx context.Context, backend api.Service, opts logsOptions, service
7074
Services: services,
7175
Follow: opts.follow,
7276
Tail: opts.tail,
77+
Since: opts.since,
78+
Until: opts.until,
7379
Timestamps: opts.timestamps,
7480
})
7581
}

pkg/api/api.go

+2
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ type ServiceStatus struct {
324324
type LogOptions struct {
325325
Services []string
326326
Tail string
327+
Since string
328+
Until string
327329
Follow bool
328330
Timestamps bool
329331
}

pkg/compose/logs.go

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ func (s *composeService) Logs(ctx context.Context, projectName string, consumer
4848
ShowStdout: true,
4949
ShowStderr: true,
5050
Follow: options.Follow,
51+
Since: options.Since,
52+
Until: options.Until,
5153
Tail: options.Tail,
5254
Timestamps: options.Timestamps,
5355
})

0 commit comments

Comments
 (0)