Fix parsing env var, needed to be in the helper too
This commit is contained in:
parent
be694f0287
commit
72b9c4c649
|
@ -101,7 +101,7 @@ func (c *ServerCommand) Run(args []string) int {
|
||||||
logFormat = os.Getenv("LOGXI_FORMAT")
|
logFormat = os.Getenv("LOGXI_FORMAT")
|
||||||
}
|
}
|
||||||
switch strings.ToLower(logFormat) {
|
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)
|
c.logger = logformat.NewVaultLoggerWithWriter(logGate, level)
|
||||||
default:
|
default:
|
||||||
c.logger = log.NewLogger(logGate, "vault")
|
c.logger = log.NewLogger(logGate, "vault")
|
||||||
|
|
|
@ -43,8 +43,12 @@ func createVaultFormatter() log.Formatter {
|
||||||
ret := &vaultFormatter{
|
ret := &vaultFormatter{
|
||||||
Mutex: &sync.Mutex{},
|
Mutex: &sync.Mutex{},
|
||||||
}
|
}
|
||||||
switch os.Getenv("LOGXI_FORMAT") {
|
logFormat := os.Getenv("VAULT_LOG_FORMAT")
|
||||||
case "vault_json", "vault-json", "vaultjson":
|
if logFormat == "" {
|
||||||
|
logFormat = os.Getenv("LOGXI_FORMAT")
|
||||||
|
}
|
||||||
|
switch strings.ToLower(logFormat) {
|
||||||
|
case "json", "vault_json", "vault-json", "vaultjson":
|
||||||
ret.style = stylejson
|
ret.style = stylejson
|
||||||
default:
|
default:
|
||||||
ret.style = styledefault
|
ret.style = styledefault
|
||||||
|
|
Loading…
Reference in a new issue