...
1 package client
2
3 import (
4 "flag"
5 "fmt"
6 "strings"
7 )
8
9 var (
10 nodebugServices = []string{
11 "registry.Registry",
12 "auth.AuthenticationService",
13 "auth.AuthManagerService",
14 "errorlogger.ErrorLogger",
15 }
16 debug_fancy = flag.Bool("ge_debug_fancy_dialer", false, "debug the fancy resolver and balancer")
17 )
18
19 type serviceNamer interface {
20 ServiceName() string
21 }
22
23 func fancyPrintf(sn serviceNamer, msg string, args ...interface{}) {
24 if !*debug_fancy {
25 return
26 }
27 s := sn.ServiceName()
28 for _, f := range nodebugServices {
29 if strings.HasPrefix(s, f) {
30 return
31 }
32 }
33 l := "[go-easyops] [" + s + "] "
34 fmt.Printf(l+msg, args...)
35 }
36
View as plain text