Alanxtl commented on code in PR #3311:
URL: https://github.com/apache/dubbo-go/pull/3311#discussion_r3158770688


##########
cluster/router/condition/matcher/pattern_value/scope.go:
##########
@@ -122,5 +122,5 @@ func convertToIntRange(rawStart, rawEnd string) (int, int, 
error) {
 }
 
 func logError(pattern, value string) {
-       logger.Errorf("Parse integer error, Invalid condition rule '%s' or 
value '%s', will ignore.", pattern, value)
+       logger.Errorf("[Scope] parse integer failed: pattern=%s, value=%s", 
pattern, value)

Review Comment:
   ```suggestion
        logger.Errorf("[Router][Condition] parse integer failed: pattern=%s, 
value=%s", pattern, value)
   ```



##########
cluster/router/chain/chain.go:
##########
@@ -131,7 +131,7 @@ func (c *RouterChain) injectStaticRouters(url *common.URL) {
        }
        staticRoutersAttr, ok := staticRoutersAttrAny.([]*global.RouterConfig)
        if !ok {
-               logger.Errorf("failed to type assert routers config: expected 
[]*global.RouterConfig, got %T", staticRoutersAttrAny)
+               logger.Errorf("[Chain] failed to type assert routers config: 
expected type=%T", staticRoutersAttrAny)

Review Comment:
   ```suggestion
                logger.Errorf("[Router][Chain] failed to type assert routers 
config: expected type=%T", staticRoutersAttrAny)
   ```
   其他同理



##########
cluster/router/affinity/router.go:
##########
@@ -55,21 +55,21 @@ func (s *ServiceAffinityRoute) Notify(invokers 
[]base.Invoker) {
 
        url := invokers[0].GetURL()
        if url == nil {
-               logger.Error("Failed to notify a Service Affinity rule, because 
url is empty")
+               logger.Error("[Affinity] failed to notify service affinity 
rule: url is empty")

Review Comment:
   ```suggestion
                logger.Error("[Router][Affinity] failed to notify service 
affinity rule: url is empty")
   ```
   
   这个文件其他的也同理



##########
cluster/router/condition/matcher/base.go:
##########
@@ -118,7 +118,7 @@ func doPatternMatch(pattern string, value string, url 
*common.URL, invocation ba
                }
        }
        // If no value matcher is available, will force to use wildcard value 
matcher
-       logger.Error("Executing condition rule value match expression error, 
will force to use wildcard value matcher")
+       logger.Errorf("[Matcher] no matching value pattern found, using 
wildcard: pattern=%s", pattern)

Review Comment:
   ```suggestion
        logger.Errorf("[Router][Condition] no matching value pattern found, 
using wildcard: pattern=%s", pattern)
   ```



##########
cluster/cluster/broadcast/cluster_invoker.go:
##########
@@ -58,7 +58,7 @@ func (invoker *broadcastClusterInvoker) Invoke(ctx 
context.Context, invocation p
        for _, ivk := range invokers {
                res = ivk.Invoke(ctx, invocation)
                if res.Error() != nil {
-                       logger.Warnf("broadcast invoker invoke err: %v when use 
invoker: %v\n", res.Error(), ivk)
+                       logger.Warnf("[Broadcast] invoke failed, err=%v 
invoker=%v", res.Error(), ivk)

Review Comment:
   ```suggestion
                        logger.Warnf("[Cluster][Broadcast] invoke failed, 
err=%v invoker=%v", res.Error(), ivk)
   ```



##########
cluster/router/tag/router.go:
##########
@@ -82,23 +82,23 @@ func (p *PriorityRouter) Notify(invokers []base.Invoker) {
        }
        application := invokers[0].GetURL().GetParam(constant.ApplicationKey, 
"")
        if application == "" {
-               logger.Warn("url application is empty, tag router will not be 
enabled")
+               logger.Warn("[Router] [Tag] url application is empty, tag 
router will not be enabled")
                return
        }
        dynamicConfiguration := conf.GetEnvInstance().GetDynamicConfiguration()
        if dynamicConfiguration == nil {
-               logger.Infof("Config center does not start, Tag router will not 
be enabled")
+               logger.Info("Config center does not start, Tag router will not 
be enabled")
                return
        }
        key := strings.Join([]string{application, 
constant.TagRouterRuleSuffix}, "")
        dynamicConfiguration.AddListener(key, p)
        value, err := dynamicConfiguration.GetRule(key)
        if err != nil {
-               logger.Errorf("query router rule fail,key=%s,err=%v", key, err)
+               logger.Errorf("[Router] [Tag] query router rule failed, key=%s 
error=%v", key, err)
                return
        }
        if value == "" {
-               logger.Infof("router rule is empty,key=%s", key)
+               logger.Info("router rule is empty")

Review Comment:
   info也加[前缀]吧



##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -113,53 +113,53 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, 
invocation base.Invocat
        m := metrics.LocalMetrics
        // picks two nodes randomly
        i, j := l.randomPicker(len(invokers))
-       logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: 
%s, invoker[%d]: %s.",
-               i, invokers[i], j, invokers[j])
+       logger.Debugf("[P2C] select two invokers i=%d j=%d", i, j)

Review Comment:
   ```suggestion
        logger.Debugf("[Loadbalance][P2C] select two invokers i=%d j=%d", i, j)
   ```
   其他同理



##########
cluster/router/condition/matcher/attachment.go:
##########
@@ -55,13 +54,13 @@ func (a *AttachmentConditionMatcher) GetValue(sample 
map[string]string, url *com
        attachmentExpress := expressArray[0]
        matcher := attachmentPattern.FindStringSubmatch(attachmentExpress)
        if len(matcher) == 0 {
-               logger.Warn(notFoundAttachmentValue)
+               logger.Warn("[Attachment] attachment key not found")

Review Comment:
   ```suggestion
                logger.Warn("[Router][Condition] attachment key not found")
   ```
   其他同理



##########
cluster/router/condition/route.go:
##########
@@ -85,7 +85,7 @@ func (s *StateRouter) Route(invokers []base.Invoker, url 
*common.URL, invocation
        }
 
        if len(s.thenCondition) == 0 {
-               logger.Warn("condition state router thenCondition is empty")
+               logger.Warn("[Router] [Condition] thenCondition is empty")

Review Comment:
   改成中间都不加空格吧
   
   ```suggestion
                logger.Warn("[Router][Condition] thenCondition is empty")
   ```
   
   其他同理



##########
cluster/router/condition/matcher/argument.go:
##########
@@ -58,19 +57,19 @@ func (a *ArgumentConditionMatcher) GetValue(sample 
map[string]string, url *commo
        argumentExpress := expressArray[0]
        matcher := argumentsPattern.FindStringSubmatch(argumentExpress)
        if len(matcher) == 0 {
-               logger.Warn(notFoundArgumentValue)
+               logger.Warn("[Argument] argument not found")

Review Comment:
   ```suggestion
                logger.Warn("[Router][Condition] argument not found")
   ```
   其他同理



##########
cluster/router/condition/dynamic_router.go:
##########
@@ -66,7 +66,7 @@ func (m *multiplyConditionRoute) route(invokers 
[]base.Invoker, url *common.URL,
        if len(m.trafficDisabled) != 0 {
                for _, cond := range m.trafficDisabled {
                        if cond.MatchRequest(url, invocation) {
-                               logger.Warnf("Request has been disabled %s by 
Condition.trafficDisable.match=\"%s\"", url.String(), cond.rule)
+                               logger.Warnf("[Condition] request traffic 
disabled: url=%s, rule=%s", url.String(), cond.rule)

Review Comment:
   ```suggestion
                                logger.Warnf("[Router][Condition] request 
traffic disabled: url=%s, rule=%s", url.String(), cond.rule)
   ```
   其他同理



##########
cluster/cluster/failback/cluster_invoker.go:
##########
@@ -65,7 +65,7 @@ func newFailbackClusterInvoker(directory directory.Directory) 
protocolbase.Invok
        retriesConfig := invoker.GetURL().GetParam(constant.RetriesKey, 
constant.DefaultFailbackTimes)
        retries, err := strconv.Atoi(retriesConfig)
        if err != nil || retries < 0 {
-               logger.Error("Your retries config is invalid,pls do a check. 
And will use the default fail back times configuration instead.")
+               logger.Error("[Failback] retries config invalid, using default")

Review Comment:
   ```suggestion
                logger.Error("[Cluster][Failback] retries config invalid, using 
default")
   ```
   
   其他同理



##########
cluster/cluster/adaptivesvc/cluster_invoker.go:
##########
@@ -86,21 +86,21 @@ func (ivk *adaptiveServiceClusterInvoker) Invoke(ctx 
context.Context, invocation
                }
        }
        if remainingStr == "" {
-               logger.Errorf("[adasvc cluster] The %s field type of value %v 
should be string.",
-                       constant.AdaptiveServiceRemainingKey, remainingIface)
+               logger.Errorf("[AdaptiveSvc] %s field type invalid, key=%s 
value=%v",
+                       constant.AdaptiveServiceRemainingKey, 
constant.AdaptiveServiceRemainingKey, remainingIface)
                return res
        }
        remaining, err := strconv.Atoi(remainingStr)
        if err != nil {
-               logger.Warnf("the remaining is unexpected, we need a int type, 
but we got %s, err: %v.", remainingStr, err)
+               logger.Warnf("[AdaptiveSvc] parse remaining failed, 
remaining=%s err=%v", remainingStr, err)
                return res
        }
-       logger.Debugf("[adasvc cluster] The server status was received 
successfully, %s: %#v",
+       logger.Debugf("[AdaptiveSvc] received server status, %s=%s",
                constant.AdaptiveServiceRemainingKey, remainingStr)
        err = metrics.LocalMetrics.SetMethodMetrics(invoker.GetURL(),
                invocation.MethodName(), metrics.HillClimbing, 
uint64(remaining))
        if err != nil {
-               logger.Warnf("adaptive service metrics update is failed, err: 
%v", err)
+               logger.Warnf("[AdaptiveSvc] update metrics failed, err=%v", err)

Review Comment:
   ```suggestion
                logger.Errorf("[Cluster][AdaptiveSvc] %s field type invalid, 
key=%s value=%v",
                        constant.AdaptiveServiceRemainingKey, 
constant.AdaptiveServiceRemainingKey, remainingIface)
   return res
   }
   remaining, err := strconv.Atoi(remainingStr)
   if err != nil {
                logger.Warnf("[Cluster][AdaptiveSvc] parse remaining failed, 
remaining=%s err=%v", remainingStr, err)
   return res
   }
        logger.Debugf("[Cluster][AdaptiveSvc] received server status, %s=%s",
   constant.AdaptiveServiceRemainingKey, remainingStr)
   err = metrics.LocalMetrics.SetMethodMetrics(invoker.GetURL(),
   invocation.MethodName(), metrics.HillClimbing, uint64(remaining))
   if err != nil {
                logger.Warnf("[Cluster][AdaptiveSvc] update metrics failed, 
err=%v", err)
   ```



##########
cluster/cluster/failover/cluster_invoker.go:
##########
@@ -97,17 +96,15 @@ func (invoker *failoverClusterInvoker) Invoke(ctx 
context.Context, invocation pr
        invokerSvc := invoker.GetURL().Service()
        invokerUrl := invoker.Directory.GetURL()
        if ivk == nil {
-               logger.Errorf("Failed to invoke the method %s of the service %s 
.No provider is available.", methodName, invokerSvc)
+               logger.Errorf("[Failover] no provider available, method=%s 
service=%s", methodName, invokerSvc)

Review Comment:
   ```suggestion
                logger.Errorf("[Cluster][Failover] no provider available, 
method=%s service=%s", methodName, invokerSvc)
   ```
   其他同理



##########
cluster/cluster/forking/cluster_invoker.go:
##########
@@ -76,7 +76,7 @@ func (invoker *forkingClusterInvoker) Invoke(ctx 
context.Context, invocation pro
                go func(k protocolbase.Invoker) {
                        result := k.Invoke(ctx, invocation)
                        if err := resultQ.Put(result); err != nil {
-                               logger.Errorf("resultQ put failed with 
exception: %v.\n", err)
+                               logger.Errorf("[Forking] resultQ put failed 
with exception err=%v", err)

Review Comment:
   ```suggestion
                                logger.Errorf("[Cluster][Forking] resultQ put 
failed with exception err=%v", err)
   ```



##########
cluster/cluster/failsafe/cluster_invoker.go:
##########
@@ -77,7 +77,7 @@ func (invoker *failsafeClusterInvoker) Invoke(ctx 
context.Context, invocation pr
        res = ivk.Invoke(ctx, invocation)
        if res.Error() != nil {
                // ignore
-               logger.Errorf("Failsafe ignore exception: %v.\n", 
res.Error().Error())
+               logger.Errorf("[Failsafe] Ignore exception, err=%v", 
res.Error().Error())

Review Comment:
   ```suggestion
                logger.Errorf("[Cluster][Failsafe] Ignore exception, err=%v", 
res.Error().Error())
   ```
   为啥这里开头的 Ignore 首字母大写了



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to