Update go-hclog and go-plugin

This commit is contained in:
Jeff Mitchell 2018-04-02 14:22:52 -04:00
parent 461133b785
commit 85584e75f4
3 changed files with 13 additions and 11 deletions

View File

@ -274,6 +274,8 @@ func (z *intLogger) logJson(t time.Time, level Level, msg string, args ...interf
}
}
args = append(z.implied, args...)
if args != nil && len(args) > 0 {
if len(args)%2 != 0 {
cs, ok := args[len(args)-1].(CapturedStacktrace)
@ -368,6 +370,8 @@ func (z *intLogger) IsError() bool {
func (z *intLogger) With(args ...interface{}) Logger {
var nz intLogger = *z
nz.implied = make([]interface{}, 0, len(z.implied)+len(args))
nz.implied = append(nz.implied, z.implied...)
nz.implied = append(nz.implied, args...)
return &nz

View File

@ -10,7 +10,6 @@ import (
"hash"
"io"
"io/ioutil"
"log"
"net"
"os"
"os/exec"
@ -234,7 +233,6 @@ func CleanupClients() {
}
managedClientsLock.Unlock()
log.Println("[DEBUG] plugin: waiting for all plugin processes to complete...")
wg.Wait()
}
@ -753,14 +751,14 @@ func (c *Client) dialer(_ string, timeout time.Duration) (net.Conn, error) {
func (c *Client) logStderr(r io.Reader) {
bufR := bufio.NewReader(r)
l := c.logger.Named(filepath.Base(c.config.Cmd.Path))
for {
line, err := bufR.ReadString('\n')
if line != "" {
c.config.Stderr.Write([]byte(line))
line = strings.TrimRightFunc(line, unicode.IsSpace)
l := c.logger.Named(filepath.Base(c.config.Cmd.Path))
entry, err := parseJSON(line)
// If output is not JSON format, print directly to Debug
if err != nil {
@ -768,7 +766,7 @@ func (c *Client) logStderr(r io.Reader) {
} else {
out := flattenKVPairs(entry.KVPairs)
l = l.With("timestamp", entry.Timestamp.Format(hclog.TimeFormat))
out = append(out, "timestamp", entry.Timestamp.Format(hclog.TimeFormat))
switch hclog.LevelFromString(entry.Level) {
case hclog.Trace:
l.Trace(entry.Message, out...)

12
vendor/vendor.json vendored
View File

@ -1087,10 +1087,10 @@
"revisionTime": "2018-02-23T19:15:17Z"
},
{
"checksumSHA1": "xTdKLI1gAJOTqswvr15a/fI8ucA=",
"checksumSHA1": "fg18dhgqDts2CI/Dz+6v5jX/xow=",
"path": "github.com/hashicorp/go-hclog",
"revision": "5bcb0f17e36442247290887cc914a6e507afa5c4",
"revisionTime": "2018-01-22T23:24:01Z"
"revision": "9b9aacd44f1c18bbf913afa45ecd1cb8ec515713",
"revisionTime": "2018-04-02T16:24:28Z"
},
{
"checksumSHA1": "y+AeKVZoX0gB+DZW4Arzkb3tTVc=",
@ -1117,10 +1117,10 @@
"revisionTime": "2017-12-04T18:29:08Z"
},
{
"checksumSHA1": "7SheX5w6+xGsTMxPI3LiJx0iz7s=",
"checksumSHA1": "lbG9uwM7qJlTIBg+8mjCC88sCPc=",
"path": "github.com/hashicorp/go-plugin",
"revision": "baa83ead6ff956b3f99bcd609ae3499c028e019e",
"revisionTime": "2018-02-16T15:44:16Z"
"revision": "e8d22c780116115ae5624720c9af0c97afe4f551",
"revisionTime": "2018-03-31T00:25:53Z"
},
{
"checksumSHA1": "yzoWV7yrS/TvOrKy5ZrdUjsYaOA=",