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

Function ServerError

internal/remotelogs/utils.go:176–213  ·  view source on GitHub ↗

ServerError 打印服务相关错误信息

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

Source from the content-addressed store, hash-verified

174
175// ServerError 打印服务相关错误信息
176func ServerError(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map) {
177 if Tea.IsTesting() {
178 logs.Println("[" + tag + "]" + description)
179 }
180
181 // 是否记录服务相关错误
182 nodeConfig, _ := nodeconfigs.SharedNodeConfig()
183 if nodeConfig != nil && nodeConfig.GlobalServerConfig != nil && !nodeConfig.GlobalServerConfig.Log.RecordServerError {
184 return
185 }
186
187 // 参数
188 var paramsJSON []byte
189 if len(params) > 0 {
190 p, err := json.Marshal(params)
191 if err != nil {
192 logs.Println("[LOG]ServerError(): json encode failed: " + err.Error())
193 } else {
194 paramsJSON = p
195 }
196 }
197
198 select {
199 case logChan <- &pb.NodeLog{
200 Role: teaconst.Role,
201 Tag: tag,
202 Description: description,
203 Level: "error",
204 NodeId: teaconst.NodeId,
205 ServerId: serverId,
206 CreatedAt: time.Now().Unix(),
207 Type: logType,
208 ParamsJSON: paramsJSON,
209 }:
210 default:
211
212 }
213}
214
215// ServerSuccess 打印服务相关成功信息
216func ServerSuccess(serverId int64, tag string, description string, logType nodeconfigs.NodeLogType, params maps.Map) {

Callers 10

ServeMethod · 0.92
connectOriginMethod · 0.92
StartMethod · 0.92
syncConfigMethod · 0.92
reloadServerMethod · 0.92
matchSSLMethod · 0.92
ServeMethod · 0.92
connectOriginMethod · 0.92
doOriginRequestMethod · 0.92
StartMethod · 0.92

Calls 2

UnixMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected