[lxc-devel] [lxd/master] lxd/cluster: Workaround new raft logging
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Apr 30 23:06:52 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190430/a6e41a91/attachment.bin>
-------------- next part --------------
From 76dd2a64582e021faca9ca4cf3b1642983e30035 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 30 Apr 2019 18:50:37 -0400
Subject: [PATCH] lxd/cluster: Workaround new raft logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/cluster/raft.go | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lxd/cluster/raft.go b/lxd/cluster/raft.go
index 13b97f432a..41f5c3b7d5 100644
--- a/lxd/cluster/raft.go
+++ b/lxd/cluster/raft.go
@@ -18,6 +18,7 @@ import (
"github.com/CanonicalLtd/raft-http"
"github.com/CanonicalLtd/raft-membership"
"github.com/boltdb/bolt"
+ "github.com/hashicorp/go-hclog"
"github.com/hashicorp/raft"
"github.com/hashicorp/raft-boltdb"
"github.com/lxc/lxd/lxd/db"
@@ -121,7 +122,7 @@ func raftInstanceInit(
return nil, err
}
- transport, handler, layer, err = raftNetworkTransport(db, addr, raftLogger, timeout, dial)
+ transport, handler, layer, err = raftNetworkTransport(db, addr, log.New(&raftLogWriter{}, "", 0), timeout, dial)
if err != nil {
return nil, err
}
@@ -432,8 +433,11 @@ func raftHandler(info *shared.CertInfo, handler *rafthttp.Handler) http.HandlerF
}
}
-func raftLogger() *log.Logger {
- return log.New(&raftLogWriter{}, "", 0)
+func raftLogger() hclog.Logger {
+ return hclog.New(&hclog.LoggerOptions{
+ Name: "raft",
+ Output: &raftLogWriter{},
+ })
}
// Implement io.Writer on top of LXD's logging system.
More information about the lxc-devel
mailing list