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)
| 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. |
| 1992 | func (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 | |
| 2023 | func (c *ServerCommand) reloadHCPLink(hcpLinkVault *hcp_link.HCPLinkVault, conf *server.Config, core *vault.Core, hcpLogger hclog.Logger) (*hcp_link.HCPLinkVault, error) { |
| 2024 | // trigger a shutdown |
no test coverage detected