2021-05-21 13:26:38 +00:00
|
|
|
package loggerconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
// config defaults
|
|
|
|
const (
|
2021-06-02 12:44:41 +00:00
|
|
|
// LevelDefault is a default logger level.
|
2021-05-21 13:26:38 +00:00
|
|
|
LevelDefault = "info"
|
|
|
|
)
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// Level returns the value of "level" config parameter
|
2021-05-21 18:03:47 +00:00
|
|
|
// from "logger" section.
|
2021-05-21 13:26:38 +00:00
|
|
|
//
|
2022-04-21 11:28:05 +00:00
|
|
|
// Returns LevelDefault if the value is not a non-empty string.
|
2021-05-21 18:03:47 +00:00
|
|
|
func Level(c *config.Config) string {
|
|
|
|
v := config.StringSafe(
|
|
|
|
c.Sub("logger"),
|
|
|
|
"level",
|
|
|
|
)
|
2021-05-21 13:26:38 +00:00
|
|
|
if v != "" {
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
return LevelDefault
|
|
|
|
}
|