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

Function ServerLog

internal/remotelogs/utils.go:248–277  ·  view source on GitHub ↗

ServerLog 打印服务相关日志信息

(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map)

Source from the content-addressed store, hash-verified

246
247// ServerLog 打印服务相关日志信息
248func ServerLog(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map) {
249 logs.Println("[" + tag + "]" + description)
250
251 // 参数
252 var paramsJSON []byte
253 if len(params) > 0 {
254 p, err := json.Marshal(params)
255 if err != nil {
256 logs.Println("[LOG]ServerLog(): json encode failed: " + err.Error())
257 } else {
258 paramsJSON = p
259 }
260 }
261
262 select {
263 case logChan <- &pb.NodeLog{
264 Role: teaconst.Role,
265 Tag: tag,
266 Description: description,
267 Level: "info",
268 NodeId: teaconst.NodeId,
269 ServerId: serverId,
270 CreatedAt: time.Now().Unix(),
271 Type: logType,
272 ParamsJSON: paramsJSON,
273 }:
274 default:
275
276 }
277}
278
279// 上传日志
280func uploadLogs() error {

Callers

nothing calls this directly

Calls 2

UnixMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected