Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogClient ¶ added in v1.1.0
type LogClient interface {
Logs(docker.LogsOptions) error
}
LogClient wraps DockerClient with the minimal interface
type LogStreamer ¶
type LogStreamer struct {
DockerClient LogClient
ContainerID string
ContainerName string
LogWriter io.WriteCloser
ErrWriter io.WriteCloser
// contains filtered or unexported fields
}
LogStreamer connects and activates container's log stream with io.Writer
func (*LogStreamer) Close ¶ added in v1.1.0
func (l *LogStreamer) Close()
Close cancels the streaming context and waits for the cancellation to propagate. The stream goroutine will exit once the Docker client observes the cancellation.
func (*LogStreamer) Err ¶ added in v1.4.0
func (l *LogStreamer) Err() error
Err returns the error from the streaming goroutine, if any. Returns nil if the stream completed normally or was canceled. Should be called after Wait() returns.
func (*LogStreamer) Go ¶
func (l *LogStreamer) Go(ctx context.Context) *LogStreamer
Go starts log streaming in a goroutine. It attaches to the container's log stream and writes to LogWriter/ErrWriter. Retries on Docker EOF errors with a 1s delay. After Wait() returns, use Err() to retrieve the error (if any) from the streaming goroutine.
func (*LogStreamer) Wait ¶ added in v1.1.0
func (l *LogStreamer) Wait()
Wait blocks until the streaming context is canceled, either by Close or parent context.
type MultiWriter ¶
type MultiWriter struct {
// contains filtered or unexported fields
}
MultiWriter implements WriteCloser for multiple destinations. It is simplified version of stdlib MultiWriter. Ignores write error and don't stop the loop unless all writes failed.
func NewMultiWriterIgnoreErrors ¶
func NewMultiWriterIgnoreErrors(writers ...io.WriteCloser) *MultiWriter
NewMultiWriterIgnoreErrors creates WriteCloser for multiple destinations
func (*MultiWriter) WithExtJSON ¶
func (w *MultiWriter) WithExtJSON(containerName, group string) *MultiWriter
WithExtJSON turn JSON output mode on