MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / init

Function init

internal/remotelogs/utils.go:22–42  ·  view source on GitHub ↗

队列数量不需要太长,因为日志通常仅仅为调试用

()

Source from the content-addressed store, hash-verified

20var logChan = make(chan *pb.NodeLog, 64) // 队列数量不需要太长,因为日志通常仅仅为调试用
21
22func init() {
23 if !teaconst.IsMain {
24 return
25 }
26
27 // 定期上传日志
28 var ticker = time.NewTicker(60 * time.Second)
29 if Tea.IsTesting() {
30 ticker = time.NewTicker(10 * time.Second)
31 }
32 goman.New(func() {
33 for range ticker.C {
34 var tr = trackers.Begin("UPLOAD_REMOTE_LOGS")
35 err := uploadLogs()
36 tr.End()
37 if err != nil {
38 logs.Println("[LOG]upload logs failed: " + err.Error())
39 }
40 }
41 })
42}
43
44// Debug 打印调试信息
45func Debug(tag string, description string) {

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
BeginFunction · 0.92
uploadLogsFunction · 0.85
EndMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected