Move to "github.com/hashicorp/go-hclog" (#4227)

* logbridge with hclog and identical output

* Initial search & replace

This compiles, but there is a fair amount of TODO
and commented out code, especially around the
plugin logclient/logserver code.

* strip logbridge

* fix majority of tests

* update logxi aliases

* WIP fixing tests

* more test fixes

* Update test to hclog

* Fix format

* Rename hclog -> log

* WIP making hclog and logxi love each other

* update logger_test.go

* clean up merged comments

* Replace RawLogger interface with a Logger

* Add some logger names

* Replace Trace with Debug

* update builtin logical logging patterns

* Fix build errors

* More log updates

* update log approach in command and builtin

* More log updates

* update helper, http, and logical directories

* Update loggers

* Log updates

* Update logging

* Update logging

* Update logging

* Update logging

* update logging in physical

* prefixing and lowercase

* Update logging

* Move phyisical logging name to server command

* Fix som tests

* address jims feedback so far

* incorporate brians feedback so far

* strip comments

* move vault.go to logging package

* update Debug to Trace

* Update go-plugin deps

* Update logging based on review comments

* Updates from review

* Unvendor logxi

* Remove null_logger.go
This commit is contained in:
Becca Petrin
2018-04-02 17:46:59 -07:00
committed by Brian Kassouf
parent ecdd877bf4
commit 792d219aa9
160 changed files with 1084 additions and 3437 deletions

View File

@@ -9,11 +9,11 @@ import (
"sort"
"testing"
log "github.com/mgutz/logxi/v1"
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/helper/logformat"
"github.com/hashicorp/vault/helper/logging"
"github.com/hashicorp/vault/http"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/physical/inmem"
@@ -135,7 +135,7 @@ func Test(tt TestT, c TestCase) {
}
// Create an in-memory Vault core
logger := logformat.NewVaultLogger(log.LevelTrace)
logger := logging.NewVaultLogger(log.Trace)
phys, err := inmem.NewInmem(nil, logger)
if err != nil {
@@ -210,8 +210,8 @@ func Test(tt TestT, c TestCase) {
// Make requests
var revoke []*logical.Request
for i, s := range c.Steps {
if log.IsWarn() {
log.Warn("Executing test step", "step_number", i+1)
if logger.IsWarn() {
logger.Warn("Executing test step", "step_number", i+1)
}
// Create the request
@@ -294,8 +294,8 @@ func Test(tt TestT, c TestCase) {
// Revoke any secrets we might have.
var failedRevokes []*logical.Secret
for _, req := range revoke {
if log.IsWarn() {
log.Warn("Revoking secret", "secret", fmt.Sprintf("%#v", req))
if logger.IsWarn() {
logger.Warn("Revoking secret", "secret", fmt.Sprintf("%#v", req))
}
req.ClientToken = client.Token()
resp, err := core.HandleRequest(req)
@@ -311,7 +311,7 @@ func Test(tt TestT, c TestCase) {
// Perform any rollbacks. This should no-op if there aren't any.
// We set the "immediate" flag here that any backend can pick up on
// to do all rollbacks immediately even if the WAL entries are new.
log.Warn("Requesting RollbackOperation")
logger.Warn("Requesting RollbackOperation")
req := logical.RollbackRequest(prefix + "/")
req.Data["immediate"] = true
req.ClientToken = client.Token()