Fix parsing env var, needed to be in the helper too

This commit is contained in:
Jeff Mitchell 2016-09-23 13:20:26 -04:00
parent be694f0287
commit 72b9c4c649
2 changed files with 7 additions and 3 deletions

View file

@ -101,7 +101,7 @@ func (c *ServerCommand) Run(args []string) int {
logFormat = os.Getenv("LOGXI_FORMAT")
}
switch strings.ToLower(logFormat) {
case "vault", "vault_json", "vault-json", "vaultjson", "":
case "vault", "vault_json", "vault-json", "vaultjson", "json", "":
c.logger = logformat.NewVaultLoggerWithWriter(logGate, level)
default:
c.logger = log.NewLogger(logGate, "vault")

View file

@ -43,8 +43,12 @@ func createVaultFormatter() log.Formatter {
ret := &vaultFormatter{
Mutex: &sync.Mutex{},
}
switch os.Getenv("LOGXI_FORMAT") {
case "vault_json", "vault-json", "vaultjson":
logFormat := os.Getenv("VAULT_LOG_FORMAT")
if logFormat == "" {
logFormat = os.Getenv("LOGXI_FORMAT")
}
switch strings.ToLower(logFormat) {
case "json", "vault_json", "vault-json", "vaultjson":
ret.style = stylejson
default:
ret.style = styledefault