فهرست منبع

fix(log): replace the plaintext password with *** in log (#1197)

Signed-off-by: Jianxiang Ran <rxan_embedded@163.com>
superxan 3 سال پیش
والد
کامیت
f8362a7cf7
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 1 1
      internal/topo/connection/clients/client_registy.go
  2. 3 3
      internal/topo/connection/clients/mqtt/mqtt.go

+ 1 - 1
internal/topo/connection/clients/client_registy.go

@@ -100,7 +100,7 @@ func GetClient(connectionType string, props map[string]interface{}) (api.Message
 	} else {
 	} else {
 		cliWpr, err := clientCreator(props)
 		cliWpr, err := clientCreator(props)
 		if err != nil {
 		if err != nil {
-			conf.Log.Errorf("can not create client for cfg : %v have error %s", props, err)
+			conf.Log.Errorf("can not create client for cfg : %v have error %s", conf.Printable(props), err)
 			return nil, err
 			return nil, err
 		}
 		}
 		conf.Log.Infof("Init client wrapper for client type %s", connectionType)
 		conf.Log.Infof("Init client wrapper for client type %s", connectionType)

+ 3 - 3
internal/topo/connection/clients/mqtt/mqtt.go

@@ -56,7 +56,7 @@ func (ms *MQTTClient) CfgValidate(props map[string]interface{}) error {
 
 
 	err := cast.MapToStruct(props, &cfg)
 	err := cast.MapToStruct(props, &cfg)
 	if err != nil {
 	if err != nil {
-		return fmt.Errorf("failed to get config for %v, the error is %s", cfg, err)
+		return fmt.Errorf("failed to get config, the error is %s", err)
 	}
 	}
 
 
 	if srv := cfg.Servers; len(srv) != 0 {
 	if srv := cfg.Servers; len(srv) != 0 {
@@ -64,12 +64,12 @@ func (ms *MQTTClient) CfgValidate(props map[string]interface{}) error {
 	} else if cfg.Server != "" {
 	} else if cfg.Server != "" {
 		ms.srv = cfg.Server
 		ms.srv = cfg.Server
 	} else {
 	} else {
-		return fmt.Errorf("missing server property for %v", cfg)
+		return fmt.Errorf("missing server property")
 	}
 	}
 
 
 	if cfg.ClientId == "" {
 	if cfg.ClientId == "" {
 		if newUUID, err := uuid.NewUUID(); err != nil {
 		if newUUID, err := uuid.NewUUID(); err != nil {
-			return fmt.Errorf("failed to get uuid for %v, the error is %s", cfg, err)
+			return fmt.Errorf("failed to get uuid, the error is %s", err)
 		} else {
 		} else {
 			ms.clientid = newUUID.String()
 			ms.clientid = newUUID.String()
 		}
 		}