Fix mobile logging

This commit is contained in:
Neil Alexander 2019-04-01 22:45:30 +01:00
parent 90feae6a7d
commit 2e72c7c93d
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/*
package mobile package mobile
/*
import ( import (
"errors" "errors"
"io" "io"

View File

@ -49,6 +49,9 @@ func (m *Yggdrasil) addStaticPeers(cfg *config.NodeConfig) {
// StartAutoconfigure starts a node with a randomly generated config // StartAutoconfigure starts a node with a randomly generated config
func (m *Yggdrasil) StartAutoconfigure() error { func (m *Yggdrasil) StartAutoconfigure() error {
logger := log.New(m.log, "", 0) logger := log.New(m.log, "", 0)
logger.EnableLevel("error")
logger.EnableLevel("warn")
logger.EnableLevel("info")
nc := config.GenerateConfig() nc := config.GenerateConfig()
nc.IfName = "dummy" nc.IfName = "dummy"
nc.AdminListen = "tcp://localhost:9001" nc.AdminListen = "tcp://localhost:9001"
@ -62,6 +65,7 @@ func (m *Yggdrasil) StartAutoconfigure() error {
} }
state, err := m.core.Start(nc, logger) state, err := m.core.Start(nc, logger)
if err != nil { if err != nil {
logger.Errorln("An error occured starting Yggdrasil:", err)
return err return err
} }
m.multicast.Init(&m.core, state, logger, nil) 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 // (rather than HJSON) by using the GenerateConfigJSON() function
func (m *Yggdrasil) StartJSON(configjson []byte) error { func (m *Yggdrasil) StartJSON(configjson []byte) error {
logger := log.New(m.log, "", 0) logger := log.New(m.log, "", 0)
logger.EnableLevel("error")
logger.EnableLevel("warn")
logger.EnableLevel("info")
nc := config.GenerateConfig() nc := config.GenerateConfig()
var dat map[string]interface{} var dat map[string]interface{}
if err := hjson.Unmarshal(configjson, &dat); err != nil { 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) state, err := m.core.Start(nc, logger)
if err != nil { if err != nil {
logger.Errorln("An error occured starting Yggdrasil:", err)
return err return err
} }
m.multicast.Init(&m.core, state, logger, nil) m.multicast.Init(&m.core, state, logger, nil)