distributor: make loglevel configurable
This commit is contained in:
parent
caf4ccb205
commit
889563b8b2
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"dev.sum7.eu/genofire/golang-lib/file"
|
"dev.sum7.eu/genofire/golang-lib/file"
|
||||||
"github.com/bdlm/log"
|
"github.com/bdlm/log"
|
||||||
|
"github.com/bdlm/std/logger"
|
||||||
"unifiedpush.org/go/np2p_dbus/distributor"
|
"unifiedpush.org/go/np2p_dbus/distributor"
|
||||||
"unifiedpush.org/go/np2p_dbus/storage"
|
"unifiedpush.org/go/np2p_dbus/storage"
|
||||||
)
|
)
|
||||||
|
@ -37,9 +38,13 @@ func defaultPath(given, filename string) string {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
configPath := ""
|
configPath := ""
|
||||||
|
loglevel := 40
|
||||||
flag.StringVar(&configPath, "c", configPath, "path to configuration file")
|
flag.StringVar(&configPath, "c", configPath, "path to configuration file")
|
||||||
|
flag.IntVar(&loglevel, "l", loglevel, "loglevel")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
log.SetLevel(logger.Level(loglevel))
|
||||||
|
|
||||||
config := &configData{}
|
config := &configData{}
|
||||||
configPath = defaultPath(configPath, "config.toml")
|
configPath = defaultPath(configPath, "config.toml")
|
||||||
if err := file.ReadTOML(configPath, config); err != nil {
|
if err := file.ReadTOML(configPath, config); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue