MCPcopy
hub / github.com/hashicorp/vault / configureLogging

Method configureLogging

command/server.go:1992–2021  ·  view source on GitHub ↗

configureLogging takes the configuration and attempts to parse config values into 'log' friendly configuration values If all goes to plan, a logger is created and setup.

(config *server.Config)

Source from the content-addressed store, hash-verified

1990// configureLogging takes the configuration and attempts to parse config values into 'log' friendly configuration values
1991// If all goes to plan, a logger is created and setup.
1992func (c *ServerCommand) configureLogging(config *server.Config) (hclog.InterceptLogger, error) {
1993 // Parse all the log related config
1994 logLevel, err := loghelper.ParseLogLevel(config.LogLevel)
1995 if err != nil {
1996 return nil, err
1997 }
1998
1999 logFormat, err := loghelper.ParseLogFormat(config.LogFormat)
2000 if err != nil {
2001 return nil, err
2002 }
2003
2004 logRotateDuration, err := parseutil.ParseDurationSecond(config.LogRotateDuration)
2005 if err != nil {
2006 return nil, err
2007 }
2008
2009 logCfg, err := loghelper.NewLogConfig("vault")
2010 if err != nil {
2011 return nil, err
2012 }
2013 logCfg.LogLevel = logLevel
2014 logCfg.LogFormat = logFormat
2015 logCfg.LogFilePath = config.LogFile
2016 logCfg.LogRotateDuration = logRotateDuration
2017 logCfg.LogRotateBytes = config.LogRotateBytes
2018 logCfg.LogRotateMaxFiles = config.LogRotateMaxFiles
2019
2020 return loghelper.Setup(logCfg, c.logWriter)
2021}
2022
2023func (c *ServerCommand) reloadHCPLink(hcpLinkVault *hcp_link.HCPLinkVault, conf *server.Config, core *vault.Core, hcpLogger hclog.Logger) (*hcp_link.HCPLinkVault, error) {
2024 // trigger a shutdown

Callers 2

runRecoveryModeMethod · 0.95
RunMethod · 0.95

Calls 1

SetupMethod · 0.65

Tested by

no test coverage detected