-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docklog: add go-plugin for forwarding of docker logs #4758
Conversation
drivers/docker/docklog/docklog.go
Outdated
|
||
// Docklog is a small utility to forward logs from a docker container to a target | ||
// destination | ||
type Docklog interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of the name. Would call it DockerLogger
drivers/docker/docklog/docklog.go
Outdated
|
||
// NewDocklog returns an implementation of the Docklog interface | ||
func NewDocklog(logger hclog.Logger) Docklog { | ||
return &dockerLogger{logger: logger} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name the logger here, that has been the pattern elsewhere?
require.NoError(err) | ||
|
||
var count int | ||
for !container.State.Running { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could replace this with testutil.WaitForResult
count++ | ||
} | ||
|
||
stdout := &noopCloser{bytes.NewBufferString("")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://golang.org/pkg/bytes/#NewBuffer and pass nil
echoToContainer(t, client, container.ID, "abc") | ||
echoToContainer(t, client, container.ID, "123") | ||
|
||
time.Sleep(2000 * time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a long sleep, why not just rely on wait for result?
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR implements a go-plugin for forwarding the logs of a docker container which will be launched by the docker task driver plugin.