123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package logger // import "github.com/docker/docker/daemon/logger"
- import (
- "errors"
- "io"
- )
- type client interface {
- Call(string, interface{}, interface{}) error
- Stream(string, interface{}) (io.ReadCloser, error)
- }
- type logPluginProxy struct {
- client
- }
- type logPluginProxyStartLoggingRequest struct {
- File string
- Info Info
- }
- type logPluginProxyStartLoggingResponse struct {
- Err string
- }
- func (pp *logPluginProxy) StartLogging(file string, info Info) (err error) {
- var (
- req logPluginProxyStartLoggingRequest
- ret logPluginProxyStartLoggingResponse
- )
- req.File = file
- req.Info = info
- if err = pp.Call("LogDriver.StartLogging", req, &ret); err != nil {
- return
- }
- if ret.Err != "" {
- err = errors.New(ret.Err)
- }
- return
- }
- type logPluginProxyStopLoggingRequest struct {
- File string
- }
- type logPluginProxyStopLoggingResponse struct {
- Err string
- }
- func (pp *logPluginProxy) StopLogging(file string) (err error) {
- var (
- req logPluginProxyStopLoggingRequest
- ret logPluginProxyStopLoggingResponse
- )
- req.File = file
- if err = pp.Call("LogDriver.StopLogging", req, &ret); err != nil {
- return
- }
- if ret.Err != "" {
- err = errors.New(ret.Err)
- }
- return
- }
- type logPluginProxyCapabilitiesResponse struct {
- Cap Capability
- Err string
- }
- func (pp *logPluginProxy) Capabilities() (cap Capability, err error) {
- var ret logPluginProxyCapabilitiesResponse
- if err = pp.Call("LogDriver.Capabilities", nil, &ret); err != nil {
- return
- }
- cap = ret.Cap
- if ret.Err != "" {
- err = errors.New(ret.Err)
- }
- return
- }
- type logPluginProxyReadLogsRequest struct {
- Info Info
- Config ReadConfig
- }
- func (pp *logPluginProxy) ReadLogs(info Info, config ReadConfig) (stream io.ReadCloser, err error) {
- var req logPluginProxyReadLogsRequest
- req.Info = info
- req.Config = config
- return pp.Stream("LogDriver.ReadLogs", req)
- }
|