chore: 优化调试日志开启引导
This commit is contained in:
@@ -31,16 +31,16 @@ func Guardian() {
|
|||||||
if global.Config.Settings.Basic.Interfaces == "" { //单网卡
|
if global.Config.Settings.Basic.Interfaces == "" { //单网卡
|
||||||
e := Login(nil)
|
e := Login(nil)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
log.Errorln("错误: ", e)
|
log.Errorln("登录出错: ", e)
|
||||||
}
|
}
|
||||||
} else { //多网卡
|
} else { //多网卡
|
||||||
interfaces, e := util.GetInterfaceAddr()
|
interfaces, e := util.GetInterfaceAddr()
|
||||||
if e == nil {
|
if e == nil {
|
||||||
for _, eth := range interfaces {
|
for _, eth := range interfaces {
|
||||||
log.Debugln("登录使用的网口: " + eth.Name)
|
log.Debugf("使用 %s 网口登录 ", eth.Name)
|
||||||
e = Login(eth.Addr)
|
e = Login(eth.Addr)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
log.Errorln("网口 ", eth.Name+" 登录失败: ", e)
|
log.Errorln("网口 ", eth.Name+" 登录出错: ", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
main.go
9
main.go
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/Mmx233/BitSrunLoginGo/controllers"
|
"github.com/Mmx233/BitSrunLoginGo/controllers"
|
||||||
"github.com/Mmx233/BitSrunLoginGo/global"
|
"github.com/Mmx233/BitSrunLoginGo/global"
|
||||||
"github.com/Mmx233/BitSrunLoginGo/util"
|
"github.com/Mmx233/BitSrunLoginGo/util"
|
||||||
@@ -19,7 +20,11 @@ func main() {
|
|||||||
var err error
|
var err error
|
||||||
if global.Config.Settings.Basic.Interfaces == "" { //单网卡
|
if global.Config.Settings.Basic.Interfaces == "" { //单网卡
|
||||||
if err = controllers.Login(nil); err != nil {
|
if err = controllers.Login(nil); err != nil {
|
||||||
log.Fatalln("运行出错,状态异常: ", err)
|
log.Errorln("登录出错: ", err)
|
||||||
|
if !global.Config.Settings.Log.DebugLevel {
|
||||||
|
fmt.Printf("开启调试日志(debug_level)获取详细信息")
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else { //多网卡
|
} else { //多网卡
|
||||||
log.Debugln("多网卡模式")
|
log.Debugln("多网卡模式")
|
||||||
@@ -27,7 +32,7 @@ func main() {
|
|||||||
for _, eth := range interfaces {
|
for _, eth := range interfaces {
|
||||||
log.Debugln("使用网卡: ", eth.Name)
|
log.Debugln("使用网卡: ", eth.Name)
|
||||||
if err = controllers.Login(eth.Addr); err != nil {
|
if err = controllers.Login(eth.Addr); err != nil {
|
||||||
log.Errorln("运行出错,状态异常: ", err)
|
log.Errorln("登录出错: ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user