From 2e72c7c93d9d9a6306d8b669a823cd395c057a44 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 1 Apr 2019 22:45:30 +0100 Subject: [PATCH] Fix mobile logging --- src/mobile/awdl.go | 2 +- src/mobile/mobile.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mobile/awdl.go b/src/mobile/awdl.go index 4fb43867..9a073ef7 100644 --- a/src/mobile/awdl.go +++ b/src/mobile/awdl.go @@ -1,6 +1,6 @@ -/* package mobile +/* import ( "errors" "io" diff --git a/src/mobile/mobile.go b/src/mobile/mobile.go index 5eec96e8..02bd30fe 100644 --- a/src/mobile/mobile.go +++ b/src/mobile/mobile.go @@ -49,6 +49,9 @@ func (m *Yggdrasil) addStaticPeers(cfg *config.NodeConfig) { // StartAutoconfigure starts a node with a randomly generated config func (m *Yggdrasil) StartAutoconfigure() error { logger := log.New(m.log, "", 0) + logger.EnableLevel("error") + logger.EnableLevel("warn") + logger.EnableLevel("info") nc := config.GenerateConfig() nc.IfName = "dummy" nc.AdminListen = "tcp://localhost:9001" @@ -62,6 +65,7 @@ func (m *Yggdrasil) StartAutoconfigure() error { } state, err := m.core.Start(nc, logger) if err != nil { + logger.Errorln("An error occured starting Yggdrasil:", err) return err } m.multicast.Init(&m.core, state, logger, nil) @@ -76,6 +80,9 @@ func (m *Yggdrasil) StartAutoconfigure() error { // (rather than HJSON) by using the GenerateConfigJSON() function func (m *Yggdrasil) StartJSON(configjson []byte) error { logger := log.New(m.log, "", 0) + logger.EnableLevel("error") + logger.EnableLevel("warn") + logger.EnableLevel("info") nc := config.GenerateConfig() var dat map[string]interface{} if err := hjson.Unmarshal(configjson, &dat); err != nil { @@ -91,6 +98,7 @@ func (m *Yggdrasil) StartJSON(configjson []byte) error { } state, err := m.core.Start(nc, logger) if err != nil { + logger.Errorln("An error occured starting Yggdrasil:", err) return err } m.multicast.Init(&m.core, state, logger, nil)