improve: error log when login fails

This commit is contained in:
Revincx
2022-10-16 10:46:46 +08:00
parent 9771d8143a
commit 83c46068c7
2 changed files with 6 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ 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()

View File

@@ -2,7 +2,6 @@ package BitSrun
import ( import (
"encoding/json" "encoding/json"
"errors"
"github.com/Mmx233/BitSrunLoginGo/global" "github.com/Mmx233/BitSrunLoginGo/global"
"github.com/Mmx233/BitSrunLoginGo/util" "github.com/Mmx233/BitSrunLoginGo/util"
@@ -119,9 +118,11 @@ func Login(c *srunTransfer.Login) error {
} }
G.LoginResult = result.(string) G.LoginResult = result.(string)
log.Infoln("登录结果: " + G.LoginResult) if G.LoginResult == "ok" {
if G.LoginResult != "ok" { log.Infoln("已成功登录~")
return errors.New(G.LoginResult) } else {
log.Errorln("登陆失败: ", e)
return nil
} }
} }