26
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								http.go
									
									
									
									
									
								
							| @@ -209,7 +209,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 		} | ||||
|  | ||||
| 		if method.Name == "" && h.opts.Logger.V(logger.ErrorLevel) { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "nil method for %s", mname) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil method for %s", mname)) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -218,7 +218,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "%v", err) | ||||
| 			continue | ||||
| 		} else if mtype == nil { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "nil mtype for %s", mname) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil mtype for %s", mname)) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -234,7 +234,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 		} | ||||
|  | ||||
| 		if err := hdlr.handlers.Insert(methods, md["Path"], pth); err != nil { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "cant add handler for %v %s", methods, md["Path"]) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add handler for %v %s", methods, md["Path"])) | ||||
| 		} | ||||
|  | ||||
| 		if h.registerRPC { | ||||
| @@ -244,7 +244,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 			} | ||||
|  | ||||
| 			if err := hdlr.handlers.Insert(methods, "/"+hn, pth); err != nil { | ||||
| 				h.opts.Logger.Errorf(h.opts.Context, "cant add rpc handler for http.MethodPost %s /%s", hn, hn) | ||||
| 				h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add rpc handler for http.MethodPost %s /%s", hn, hn)) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -268,7 +268,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 		} | ||||
|  | ||||
| 		if method.Name == "" && h.opts.Logger.V(logger.ErrorLevel) { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "nil method for %s", mname) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil method for %s", mname)) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -277,7 +277,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "%v", err) | ||||
| 			continue | ||||
| 		} else if mtype == nil { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "nil mtype for %s", mname) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("nil mtype for %s", mname)) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| @@ -293,7 +293,7 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 		} | ||||
|  | ||||
| 		if err := hdlr.handlers.Insert(methods, md.Path, pth); err != nil { | ||||
| 			h.opts.Logger.Errorf(h.opts.Context, "cant add handler for %s %s", md.Method, md.Path) | ||||
| 			h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add handler for %s %s", md.Method, md.Path)) | ||||
| 		} | ||||
|  | ||||
| 		if h.registerRPC { | ||||
| @@ -302,9 +302,9 @@ func (h *Server) NewHandler(handler interface{}, opts ...server.HandlerOption) s | ||||
| 				methods = append(methods, http.MethodOptions) | ||||
| 			} | ||||
|  | ||||
| 			h.opts.Logger.Infof(h.opts.Context, "register rpc handler for http.MethodPost %s /%s", hn, hn) | ||||
| 			h.opts.Logger.Info(h.opts.Context, fmt.Sprintf("register rpc handler for http.MethodPost %s /%s", hn, hn)) | ||||
| 			if err := hdlr.handlers.Insert(methods, "/"+hn, pth); err != nil { | ||||
| 				h.opts.Logger.Errorf(h.opts.Context, "cant add rpc handler for http.MethodPost %s /%s", hn, hn) | ||||
| 				h.opts.Logger.Error(h.opts.Context, fmt.Sprintf("cant add rpc handler for http.MethodPost %s /%s", hn, hn)) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -387,7 +387,7 @@ func (h *Server) Register() error { | ||||
|  | ||||
| 	if !registered { | ||||
| 		if config.Logger.V(logger.InfoLevel) { | ||||
| 			config.Logger.Infof(config.Context, "Register [%s] Registering node: %s", config.Register.String(), service.Nodes[0].ID) | ||||
| 			config.Logger.Info(config.Context, fmt.Sprintf("Register [%s] Registering node: %s", config.Register.String(), service.Nodes[0].ID)) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -450,7 +450,7 @@ func (h *Server) Deregister() error { | ||||
| 	} | ||||
|  | ||||
| 	if config.Logger.V(logger.InfoLevel) { | ||||
| 		config.Logger.Infof(config.Context, "Deregistering node: %s", service.Nodes[0].ID) | ||||
| 		config.Logger.Info(config.Context, "Deregistering node: "+service.Nodes[0].ID) | ||||
| 	} | ||||
|  | ||||
| 	if err := server.DefaultDeregisterFunc(service, config); err != nil { | ||||
| @@ -474,10 +474,10 @@ func (h *Server) Deregister() error { | ||||
| 		} | ||||
|  | ||||
| 		for _, sub := range subs { | ||||
| 			config.Logger.Infof(config.Context, "Unsubscribing from topic: %s", sub.Topic()) | ||||
| 			config.Logger.Info(config.Context, "Unsubscribing from topic: "+sub.Topic()) | ||||
| 			if err := sub.Unsubscribe(subCtx); err != nil { | ||||
| 				h.Unlock() | ||||
| 				config.Logger.Errorf(config.Context, "failed to unsubscribe topic: %s, error: %v", sb.Topic(), err) | ||||
| 				config.Logger.Error(config.Context, fmt.Sprintf("failed to unsubscribe topic: %s, error", sb.Topic()), err) | ||||
| 				return err | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user