add NewDockerLogs constructor method

This commit is contained in:
Bradley Cicenas 2017-11-28 14:36:28 +00:00
parent 53c0f2a9df
commit 3e5176a79c
2 changed files with 9 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func (c *Docker) Stream() chan models.Metrics {
}
func (c *Docker) Logs() LogCollector {
return &DockerLogs{c.id, c.client, make(chan bool)}
return NewDockerLogs(c.id, c.client)
}
// Stop collector

View File

@ -17,6 +17,14 @@ type DockerLogs struct {
done chan bool
}
func NewDockerLogs(id string, client *api.Client) *DockerLogs {
return &DockerLogs{
id: id,
client: client,
done: make(chan bool),
}
}
func (l *DockerLogs) Stream() chan models.Log {
r, w := io.Pipe()
logCh := make(chan models.Log)