mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
27bd6842f8
Logging plugins use the same HTTP interface as other plugins for basic command operations meanwhile actual logging operations are handled (on Unix) via a fifo. The plugin interface looks like so: ```go type loggingPlugin interface { StartLogging(fifoPath string, loggingContext Context) error StopLogging(fifoPath) ``` This means a plugin must implement `LoggingDriver.StartLogging` and `LoggingDriver.StopLogging` endpoints and be able to consume the passed in fifo. Logs are sent via stream encoder to the fifo encoded with protobuf. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
20 lines
459 B
Go
20 lines
459 B
Go
// +build linux solaris freebsd
|
|
|
|
package logger
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/tonistiigi/fifo"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func openPluginStream(a *pluginAdapter) (io.WriteCloser, error) {
|
|
f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_WRONLY|unix.O_CREAT|unix.O_NONBLOCK, 0700)
|
|
if err != nil {
|
|
return nil, errors.Wrapf(err, "error creating i/o pipe for log plugin: %s", a.Name())
|
|
}
|
|
return f, nil
|
|
}
|