40 lines
911 B
Go
40 lines
911 B
Go
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())
|
|
}
|
|
}
|