Add core numbers to output in dev three node

This commit is contained in:
Jeff Mitchell 2017-11-10 16:21:46 -05:00
parent ab3b625a3b
commit e66c4b11d5
2 changed files with 16 additions and 3 deletions

View file

@ -29,11 +29,13 @@ import (
"github.com/armon/go-metrics/circonus"
"github.com/armon/go-metrics/datadog"
"github.com/hashicorp/errwrap"
hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/vault/audit"
"github.com/hashicorp/vault/command/server"
"github.com/hashicorp/vault/helper/flag-slice"
"github.com/hashicorp/vault/helper/gated-writer"
"github.com/hashicorp/vault/helper/logbridge"
"github.com/hashicorp/vault/helper/logformat"
"github.com/hashicorp/vault/helper/mlock"
"github.com/hashicorp/vault/helper/parseutil"
@ -123,7 +125,14 @@ func (c *ServerCommand) Run(args []string) int {
}
switch strings.ToLower(logFormat) {
case "vault", "vault_json", "vault-json", "vaultjson", "json", "":
c.logger = logformat.NewVaultLoggerWithWriter(c.logGate, level)
if devThreeNode {
c.logger = logbridge.NewLogger(hclog.New(&hclog.LoggerOptions{
Mutex: &sync.Mutex{},
Output: c.logGate,
})).LogxiLogger()
} else {
c.logger = logformat.NewVaultLoggerWithWriter(c.logGate, level)
}
default:
c.logger = log.NewLogger(c.logGate, "vault")
c.logger.SetLevel(level)
@ -850,6 +859,7 @@ func (c *ServerCommand) enableThreeNodeDevCluster(base *vault.CoreConfig, info m
testCluster := vault.NewTestCluster(&testing.RuntimeT{}, base, &vault.TestClusterOptions{
HandlerFunc: vaulthttp.Handler,
BaseListenAddress: devListenAddress,
RawLogger: c.logger,
})
defer c.cleanupGuard.Do(testCluster.Cleanup)

View file

@ -1120,8 +1120,11 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te
}
if opts != nil && opts.RawLogger != nil {
if hclogger, ok := opts.RawLogger.(*logbridge.Logger); ok {
coreConfig.Logger = hclogger.Named(fmt.Sprintf("core%d", i)).LogxiLogger()
switch opts.RawLogger.(type) {
case *logbridge.Logger:
coreConfig.Logger = opts.RawLogger.(*logbridge.Logger).Named(fmt.Sprintf("core%d", i)).LogxiLogger()
case *logbridge.LogxiLogger:
coreConfig.Logger = opts.RawLogger.(*logbridge.LogxiLogger).Named(fmt.Sprintf("core%d", i))
}
}