调整个别日志级别

This commit is contained in:
GoEdgeLab
2021-05-23 20:45:14 +08:00
parent b858553a86
commit ac24b6a473
4 changed files with 44 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ func init() {
}()
}
// 打印普通信息
// Println 打印普通信息
func Println(tag string, description string) {
logs.Println("[" + tag + "]" + description)
@@ -47,7 +47,7 @@ func Println(tag string, description string) {
}
}
// 打印警告信息
// Warn 打印警告信息
func Warn(tag string, description string) {
logs.Println("[" + tag + "]" + description)
@@ -70,7 +70,7 @@ func Warn(tag string, description string) {
}
}
// 打印错误信息
// Error 打印错误信息
func Error(tag string, description string) {
logs.Println("[" + tag + "]" + description)
@@ -93,6 +93,30 @@ func Error(tag string, description string) {
}
}
// ServerError 打印错误信息
func ServerError(serverId int64, tag string, description string) {
logs.Println("[" + tag + "]" + description)
nodeConfig, _ := nodeconfigs.SharedNodeConfig()
if nodeConfig == nil {
return
}
select {
case logChan <- &pb.NodeLog{
Role: teaconst.Role,
Tag: tag,
Description: description,
Level: "error",
NodeId: nodeConfig.Id,
ServerId: serverId,
CreatedAt: time.Now().Unix(),
}:
default:
}
}
// 上传日志
func uploadLogs() error {
logList := []*pb.NodeLog{}