Skip to content

Commit

Permalink
Adds more logging for fetching logs between dates
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Dec 1, 2021
1 parent f0bd0f2 commit 2246b58
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docker/client.go
Expand Up @@ -75,8 +75,8 @@ func (d *dockerClient) FindContainer(id string) (Container, error) {
break
}
}
if found == false {
return container, fmt.Errorf("Unable to find container with id: %s", id)
if !found {
return container, fmt.Errorf("unable to find container with id: %s", id)
}

return container, nil
Expand Down Expand Up @@ -174,6 +174,7 @@ func (d *dockerClient) ContainerLogs(ctx context.Context, id string, tailSize in
Since: since,
}

log.Debugf("streaming logs from Docker with option: %+v", options)
reader, err := d.cli.ContainerLogs(ctx, id, options)
if err != nil {
return nil, err
Expand Down Expand Up @@ -221,10 +222,12 @@ func (d *dockerClient) ContainerLogsBetweenDates(ctx context.Context, id string,
ShowStdout: true,
ShowStderr: true,
Timestamps: true,
Since: strconv.FormatInt(from.Unix(), 10),
Until: strconv.FormatInt(to.Unix(), 10),
Since: from.Format(time.RFC3339),
Until: to.Format(time.RFC3339),
}

log.Debugf("fetch logs from Docker with option: %+v", options)

reader, err := d.cli.ContainerLogs(ctx, id, options)

if err != nil {
Expand Down

0 comments on commit 2246b58

Please sign in to comment.