管理端全部功能跑通
This commit is contained in:
39
EdgeHttpDNS/internal/nodes/runtime_log.go
Normal file
39
EdgeHttpDNS/internal/nodes/runtime_log.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package nodes
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeHttpDNS/internal/rpc"
|
||||
)
|
||||
|
||||
func reportRuntimeLog(level string, logType string, module string, description string, requestID string) {
|
||||
rpcClient, err := rpc.SharedRPC()
|
||||
if err != nil {
|
||||
log.Println("[HTTPDNS_NODE][runtime-log]", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
nodeID := int64(0)
|
||||
|
||||
now := time.Now()
|
||||
_, err = rpcClient.HTTPDNSRuntimeLogRPC.CreateHTTPDNSRuntimeLogs(rpcClient.Context(), &pb.CreateHTTPDNSRuntimeLogsRequest{
|
||||
Logs: []*pb.HTTPDNSRuntimeLog{
|
||||
{
|
||||
NodeId: nodeID,
|
||||
Level: level,
|
||||
Type: logType,
|
||||
Module: module,
|
||||
Description: description,
|
||||
Count: 1,
|
||||
RequestId: requestID,
|
||||
CreatedAt: now.Unix(),
|
||||
Day: now.Format("20060102"),
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Println("[HTTPDNS_NODE][runtime-log]", err.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user