Move towards using external binaries / RPC plugins
- First RPC steps - Work on some flaws in RPC model - Remove unused TLS settings from Engine and Swarm options - Add code to correctly encode data over the network - Add client driver for RPC - Rename server driver file - Start to make marshal make sense - Fix silly RPC method args and add client - Fix some issues with RPC calls, and marshaling - Simplify plugin main.go - Move towards 100% plugin in CLI - Ensure that plugin servers are cleaned up properly - Make flag parsing for driver flags work properly Includes some work carried from @dmp42 updating the build process and tests to use the new method. Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package log
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Why the interface? We may only want to print to STDOUT and STDERR for now,
|
||||
@@ -33,7 +34,9 @@ type Logger interface {
|
||||
}
|
||||
|
||||
var (
|
||||
l = StandardLogger{}
|
||||
l = StandardLogger{
|
||||
mu: &sync.Mutex{},
|
||||
}
|
||||
IsDebug bool = false
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type StandardLogger struct {
|
||||
@@ -12,27 +13,36 @@ type StandardLogger struct {
|
||||
fieldOut string
|
||||
OutWriter io.Writer
|
||||
ErrWriter io.Writer
|
||||
mu *sync.Mutex
|
||||
}
|
||||
|
||||
func (t StandardLogger) log(args ...interface{}) {
|
||||
defer t.mu.Unlock()
|
||||
t.mu.Lock()
|
||||
fmt.Fprint(t.OutWriter, args...)
|
||||
fmt.Fprint(t.OutWriter, t.fieldOut, "\n")
|
||||
t.fieldOut = ""
|
||||
}
|
||||
|
||||
func (t StandardLogger) logf(fmtString string, args ...interface{}) {
|
||||
defer t.mu.Unlock()
|
||||
t.mu.Lock()
|
||||
fmt.Fprintf(t.OutWriter, fmtString, args...)
|
||||
fmt.Fprint(t.OutWriter, "\n")
|
||||
t.fieldOut = ""
|
||||
}
|
||||
|
||||
func (t StandardLogger) err(args ...interface{}) {
|
||||
defer t.mu.Unlock()
|
||||
t.mu.Lock()
|
||||
fmt.Fprint(t.ErrWriter, args...)
|
||||
fmt.Fprint(t.ErrWriter, t.fieldOut, "\n")
|
||||
t.fieldOut = ""
|
||||
}
|
||||
|
||||
func (t StandardLogger) errf(fmtString string, args ...interface{}) {
|
||||
defer t.mu.Unlock()
|
||||
t.mu.Lock()
|
||||
fmt.Fprintf(t.ErrWriter, fmtString, args...)
|
||||
fmt.Fprint(t.ErrWriter, t.fieldOut, "\n")
|
||||
t.fieldOut = ""
|
||||
@@ -59,7 +69,6 @@ func (t StandardLogger) Errorf(fmtString string, args ...interface{}) {
|
||||
}
|
||||
|
||||
func (t StandardLogger) Errorln(args ...interface{}) {
|
||||
|
||||
t.err(args...)
|
||||
}
|
||||
|
||||
@@ -94,10 +103,12 @@ func (t StandardLogger) Printf(fmtString string, args ...interface{}) {
|
||||
}
|
||||
|
||||
func (t StandardLogger) Warn(args ...interface{}) {
|
||||
fmt.Print("WARNING >>> ")
|
||||
t.log(args...)
|
||||
}
|
||||
|
||||
func (t StandardLogger) Warnf(fmtString string, args ...interface{}) {
|
||||
fmt.Print("WARNING >>> ")
|
||||
t.logf(fmtString, args...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user