You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/23 07:38:17 UTC

[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #847: fix: nodes format not works

nic-chen commented on a change in pull request #847:
URL: https://github.com/apache/apisix-dashboard/pull/847#discussion_r528511503



##########
File path: api/internal/core/entity/format.go
##########
@@ -17,26 +17,30 @@
 package entity
 
 import (
-	"log"
 	"strconv"
 	"strings"
+
+	"github.com/apisix/manager-api/log"
 )
 
 func NodesFormat(obj interface{}) interface{} {
 	var nodes []*Node
-	if value, ok := obj.(map[string]float64); ok {
+	switch objType := obj.(type) {
+	case map[string]float64:
+		log.Infof("nodes type: %v", objType)
 		var strArr []string
+		value := obj.(map[string]float64)
 		for key, val := range value {
 			node := &Node{}
 			strArr = strings.Split(key, ":")
 			if len(strArr) != 2 {
-				log.Println("length of string array is not 2")
+				log.Warn("length of string array is not 2")
 				return obj
 			}
 
 			port, err := strconv.Atoi(strArr[1])
 			if err != nil {
-				log.Println("parse int fail:", err)
+				log.Errorf("parse int fail:", err)

Review comment:
       fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org