5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-26 20:35:40 +00:00

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
/*
import (
"errors"
"io"

View File

@ -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)