package docker

import (
	"context"
	"io"

	"github.com/docker/docker/api/types"
)

// ContainerLogStream returns the logs generated by a container in an io.ReadCloser.
func (d *Docker) ContainerLogStream(name string) (io.ReadCloser, error) {
	options := types.ContainerLogsOptions{
		Since:      "",
		Until:      "",
		Tail:       "all",
		ShowStdout: true,
		ShowStderr: true,
		Follow:     true,
		Timestamps: false,
		Details:    false,
	}

	ctx := context.Background()

	reader, err := d.ContainerLogs(ctx, name, options)
	if err != nil {
		return nil, err
	}

	return reader, nil
}
