Commit 4239c49d authored by wei.xuan's avatar wei.xuan

add log

parent 81ff6a2e
......@@ -42,7 +42,7 @@ func (m *MajoraEventListener) OnError(session getty.Session, err error) {
}
func (m *MajoraEventListener) OnCron(session getty.Session) {
getty.GetLogger().Debugf("thread:%d stat:%v", runtime.NumGoroutine(), session.IsClosed())
getty.GetLogger().Warnf("thread:%d stat:%v", runtime.NumGoroutine(), session.IsClosed())
m.client.Redial(session)
}
......
......@@ -78,15 +78,17 @@ func InitialSession(session getty.Session, client *Client) (err error) {
}
func (client *Client) Redial(session getty.Session) {
getty.GetLogger().Warnf("=================redial start ==============", client.config.Redial.Valid())
if !client.config.Redial.Valid() {
return
}
client.CloseAll(session)
getty.GetLogger().Warn("=================redial->offline ==============")
if _, _, err := session.WritePkg(OfflinePacket, time.Second*10); err != nil {
getty.GetLogger().Warnf("write offline to server error %s", err.Error())
}
getty.GetLogger().Info("=================redial start ==============")
getty.GetLogger().Warn("=================redial->close local session ==============")
client.CloseAll(session)
getty.GetLogger().Warnf("=================redial->wait %v ==============", client.config.Redial.WaitTime)
time.Sleep(client.config.Redial.WaitTime)
infra.Redial(client.config)
}
......@@ -33,7 +33,7 @@ func Redial(cfg *model.Configure) {
cmd := exec.Command(command, args, execPath)
output, err := cmd.Output()
if err != nil {
getty.GetLogger().Errorf("Execute Shell:%s failed with error:%s", command, err.Error())
getty.GetLogger().Errorf("[redial] Execute Shell:%s failed with error:%s", command, err.Error())
return
}
getty.GetLogger().Infof("[redial] redial success %+v resp:%s", cmd, string(output))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment