Don't resetnamed
This commit is contained in:
parent
ba0d029247
commit
362a92945e
|
@ -423,7 +423,7 @@ func (c *ServerCommand) Run(args []string) int {
|
||||||
c.UI.Error(fmt.Sprintf("Unknown storage type %s", config.Storage.Type))
|
c.UI.Error(fmt.Sprintf("Unknown storage type %s", config.Storage.Type))
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
backend, err := factory(config.Storage.Config, c.logger.ResetNamed("storage."+config.Storage.Type))
|
backend, err := factory(config.Storage.Config, c.logger.Named("storage."+config.Storage.Type))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Error initializing storage of type %s: %s", config.Storage.Type, err))
|
c.UI.Error(fmt.Sprintf("Error initializing storage of type %s: %s", config.Storage.Type, err))
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -308,7 +308,7 @@ func (c *Core) persistAudit(ctx context.Context, table *MountTable, localOnly bo
|
||||||
// setupAudit is invoked after we've loaded the audit able to
|
// setupAudit is invoked after we've loaded the audit able to
|
||||||
// initialize the audit backends
|
// initialize the audit backends
|
||||||
func (c *Core) setupAudits(ctx context.Context) error {
|
func (c *Core) setupAudits(ctx context.Context) error {
|
||||||
broker := NewAuditBroker(c.logger.ResetNamed("audit"))
|
broker := NewAuditBroker(c.baseLogger.Named("audit"))
|
||||||
|
|
||||||
c.auditLock.Lock()
|
c.auditLock.Lock()
|
||||||
defer c.auditLock.Unlock()
|
defer c.auditLock.Unlock()
|
||||||
|
@ -379,7 +379,7 @@ func (c *Core) removeAuditReloadFunc(entry *MountEntry) {
|
||||||
c.reloadFuncsLock.Lock()
|
c.reloadFuncsLock.Lock()
|
||||||
|
|
||||||
if c.logger.IsDebug() {
|
if c.logger.IsDebug() {
|
||||||
c.logger.ResetNamed("audit").Debug("removing reload function", "path", entry.Path)
|
c.baseLogger.Named("audit").Debug("removing reload function", "path", entry.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(c.reloadFuncs, key)
|
delete(c.reloadFuncs, key)
|
||||||
|
@ -412,7 +412,7 @@ func (c *Core) newAuditBackend(ctx context.Context, entry *MountEntry, view logi
|
||||||
return nil, fmt.Errorf("nil backend returned from %q factory function", entry.Type)
|
return nil, fmt.Errorf("nil backend returned from %q factory function", entry.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
auditLogger := c.logger.ResetNamed("audit")
|
auditLogger := c.baseLogger.Named("audit")
|
||||||
|
|
||||||
switch entry.Type {
|
switch entry.Type {
|
||||||
case "file":
|
case "file":
|
||||||
|
|
|
@ -580,7 +580,7 @@ func (c *Core) newCredentialBackend(ctx context.Context, entry *MountEntry, sysV
|
||||||
|
|
||||||
config := &logical.BackendConfig{
|
config := &logical.BackendConfig{
|
||||||
StorageView: view,
|
StorageView: view,
|
||||||
Logger: c.logger.ResetNamed(fmt.Sprintf("auth.%s.%s", t, entry.Accessor)),
|
Logger: c.baseLogger.Named(fmt.Sprintf("auth.%s.%s", t, entry.Accessor)),
|
||||||
Config: conf,
|
Config: conf,
|
||||||
System: sysView,
|
System: sysView,
|
||||||
BackendUUID: entry.BackendAwareUUID,
|
BackendUUID: entry.BackendAwareUUID,
|
||||||
|
|
|
@ -274,7 +274,10 @@ type Core struct {
|
||||||
defaultLeaseTTL time.Duration
|
defaultLeaseTTL time.Duration
|
||||||
maxLeaseTTL time.Duration
|
maxLeaseTTL time.Duration
|
||||||
|
|
||||||
logger log.Logger
|
// baseLogger is used to avoid ResetNamed as it strips useful prefixes in
|
||||||
|
// e.g. testing
|
||||||
|
baseLogger log.Logger
|
||||||
|
logger log.Logger
|
||||||
|
|
||||||
// cachingDisabled indicates whether caches are disabled
|
// cachingDisabled indicates whether caches are disabled
|
||||||
cachingDisabled bool
|
cachingDisabled bool
|
||||||
|
@ -482,6 +485,7 @@ func NewCore(conf *CoreConfig) (*Core, error) {
|
||||||
router: NewRouter(),
|
router: NewRouter(),
|
||||||
sealed: new(uint32),
|
sealed: new(uint32),
|
||||||
standby: true,
|
standby: true,
|
||||||
|
baseLogger: conf.Logger,
|
||||||
logger: conf.Logger.Named("core"),
|
logger: conf.Logger.Named("core"),
|
||||||
defaultLeaseTTL: conf.DefaultLeaseTTL,
|
defaultLeaseTTL: conf.DefaultLeaseTTL,
|
||||||
maxLeaseTTL: conf.MaxLeaseTTL,
|
maxLeaseTTL: conf.MaxLeaseTTL,
|
||||||
|
@ -534,15 +538,15 @@ func NewCore(conf *CoreConfig) (*Core, error) {
|
||||||
}
|
}
|
||||||
c.seal.SetCore(c)
|
c.seal.SetCore(c)
|
||||||
|
|
||||||
c.sealUnwrapper = NewSealUnwrapper(phys, conf.Logger.ResetNamed("storage.sealunwrapper"))
|
c.sealUnwrapper = NewSealUnwrapper(phys, c.baseLogger.Named("storage.sealunwrapper"))
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
// Wrap the physical backend in a cache layer if enabled
|
// Wrap the physical backend in a cache layer if enabled
|
||||||
if txnOK {
|
if txnOK {
|
||||||
c.physical = physical.NewTransactionalCache(c.sealUnwrapper, conf.CacheSize, conf.Logger.ResetNamed("storage.cache"))
|
c.physical = physical.NewTransactionalCache(c.sealUnwrapper, conf.CacheSize, c.baseLogger.Named("storage.cache"))
|
||||||
} else {
|
} else {
|
||||||
c.physical = physical.NewCache(c.sealUnwrapper, conf.CacheSize, conf.Logger.ResetNamed("storage.cache"))
|
c.physical = physical.NewCache(c.sealUnwrapper, conf.CacheSize, c.baseLogger.Named("storage.cache"))
|
||||||
}
|
}
|
||||||
c.physicalCache = c.physical.(physical.ToggleablePurgemonster)
|
c.physicalCache = c.physical.(physical.ToggleablePurgemonster)
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ func (c *Core) setupExpiration() error {
|
||||||
view := c.systemBarrierView.SubView(expirationSubPath)
|
view := c.systemBarrierView.SubView(expirationSubPath)
|
||||||
|
|
||||||
// Create the manager
|
// Create the manager
|
||||||
mgr := NewExpirationManager(c, view, c.logger.ResetNamed("expiration"))
|
mgr := NewExpirationManager(c, view, c.baseLogger.Named("expiration"))
|
||||||
c.expiration = mgr
|
c.expiration = mgr
|
||||||
|
|
||||||
// Link the token store to this
|
// Link the token store to this
|
||||||
|
|
|
@ -925,7 +925,7 @@ func (c *Core) newLogicalBackend(ctx context.Context, entry *MountEntry, sysView
|
||||||
|
|
||||||
config := &logical.BackendConfig{
|
config := &logical.BackendConfig{
|
||||||
StorageView: view,
|
StorageView: view,
|
||||||
Logger: c.logger.ResetNamed(fmt.Sprintf("secrets.%s.%s", t, entry.Accessor)),
|
Logger: c.baseLogger.Named(fmt.Sprintf("secrets.%s.%s", t, entry.Accessor)),
|
||||||
Config: conf,
|
Config: conf,
|
||||||
System: sysView,
|
System: sysView,
|
||||||
BackendUUID: entry.BackendAwareUUID,
|
BackendUUID: entry.BackendAwareUUID,
|
||||||
|
|
|
@ -204,7 +204,7 @@ func NewPolicyStore(ctx context.Context, core *Core, baseView *BarrierView, syst
|
||||||
func (c *Core) setupPolicyStore(ctx context.Context) error {
|
func (c *Core) setupPolicyStore(ctx context.Context) error {
|
||||||
// Create the policy store
|
// Create the policy store
|
||||||
sysView := &dynamicSystemView{core: c}
|
sysView := &dynamicSystemView{core: c}
|
||||||
c.policyStore = NewPolicyStore(ctx, c, c.systemBarrierView, sysView, c.logger.ResetNamed("policy"))
|
c.policyStore = NewPolicyStore(ctx, c, c.systemBarrierView, sysView, c.baseLogger.Named("policy"))
|
||||||
|
|
||||||
if c.ReplicationState().HasState(consts.ReplicationPerformanceSecondary) {
|
if c.ReplicationState().HasState(consts.ReplicationPerformanceSecondary) {
|
||||||
// Policies will sync from the primary
|
// Policies will sync from the primary
|
||||||
|
|
|
@ -242,7 +242,7 @@ func (c *Core) startRollback() error {
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
c.rollback = NewRollbackManager(c.activeContext, c.logger.ResetNamed("rollback"), backendsFunc, c.router, c)
|
c.rollback = NewRollbackManager(c.activeContext, c.baseLogger.Named("rollback"), backendsFunc, c.router, c)
|
||||||
c.rollback.Start()
|
c.rollback.Start()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue