fix(be):使用next-terminal 自定义的日志

This commit is contained in:
teaser
2021-03-19 22:58:47 +08:00
committed by dushixiang
parent e957545f1d
commit 0e4a5f97d9
19 changed files with 322 additions and 184 deletions

View File

@ -4,9 +4,8 @@ import (
"strconv"
"time"
"next-terminal/pkg/log"
"next-terminal/server/constant"
"github.com/sirupsen/logrus"
)
func SetupTicker() {
@ -22,7 +21,7 @@ func SetupTicker() {
if now.Sub(sessions[i].ConnectedTime.Time) > time.Hour*1 {
_ = sessionRepository.DeleteById(sessions[i].ID)
s := sessions[i].Username + "@" + sessions[i].IP + ":" + strconv.Itoa(sessions[i].Port)
logrus.Infof("会话「%v」ID「%v」超过1小时未打开已删除。", s, sessions[i].ID)
log.Infof("会话「%v」ID「%v」超过1小时未打开已删除。", s, sessions[i].ID)
}
}
}
@ -56,7 +55,7 @@ func SetupTicker() {
}
err := sessionRepository.DeleteByIds(sessionIds)
if err != nil {
logrus.Errorf("删除离线会话失败 %v", err)
log.Errorf("删除离线会话失败 %v", err)
}
}
}