ServerSuccess 打印服务相关成功信息
(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map)
| 214 | |
| 215 | // ServerSuccess 打印服务相关成功信息 |
| 216 | func ServerSuccess(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map) { |
| 217 | logs.Println("[" + tag + "]" + description) |
| 218 | |
| 219 | // 参数 |
| 220 | var paramsJSON []byte |
| 221 | if len(params) > 0 { |
| 222 | p, err := json.Marshal(params) |
| 223 | if err != nil { |
| 224 | logs.Println("[LOG]ServerSuccess(): json encode failed: " + err.Error()) |
| 225 | } else { |
| 226 | paramsJSON = p |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | select { |
| 231 | case logChan <- &pb.NodeLog{ |
| 232 | Role: teaconst.Role, |
| 233 | Tag: tag, |
| 234 | Description: description, |
| 235 | Level: "success", |
| 236 | NodeId: teaconst.NodeId, |
| 237 | ServerId: serverId, |
| 238 | CreatedAt: time.Now().Unix(), |
| 239 | Type: logType, |
| 240 | ParamsJSON: paramsJSON, |
| 241 | }: |
| 242 | default: |
| 243 | |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | // ServerLog 打印服务相关日志信息 |
| 248 | func ServerLog(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map) { |
no test coverage detected