From f8362a7cf7168876996ab5c1e2d475b6037b1006 Mon Sep 17 00:00:00 2001 From: superxan <33817352+SuperRxan@users.noreply.github.com> Date: Wed, 2 Mar 2022 18:27:25 +0800 Subject: [PATCH] fix(log): replace the plaintext password with *** in log (#1197) Signed-off-by: Jianxiang Ran --- internal/topo/connection/clients/client_registy.go | 2 +- internal/topo/connection/clients/mqtt/mqtt.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/topo/connection/clients/client_registy.go b/internal/topo/connection/clients/client_registy.go index 738c02c06b..f3f547c1d9 100644 --- a/internal/topo/connection/clients/client_registy.go +++ b/internal/topo/connection/clients/client_registy.go @@ -100,7 +100,7 @@ func GetClient(connectionType string, props map[string]interface{}) (api.Message } else { cliWpr, err := clientCreator(props) 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 } conf.Log.Infof("Init client wrapper for client type %s", connectionType) diff --git a/internal/topo/connection/clients/mqtt/mqtt.go b/internal/topo/connection/clients/mqtt/mqtt.go index 6da26bcd95..907417a707 100644 --- a/internal/topo/connection/clients/mqtt/mqtt.go +++ b/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) 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 { @@ -64,12 +64,12 @@ func (ms *MQTTClient) CfgValidate(props map[string]interface{}) error { } else if cfg.Server != "" { ms.srv = cfg.Server } else { - return fmt.Errorf("missing server property for %v", cfg) + return fmt.Errorf("missing server property") } if cfg.ClientId == "" { 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 { ms.clientid = newUUID.String() }