File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"crypto/tls"
6
6
"encoding/binary"
7
+ "encoding/json"
7
8
"fmt"
8
9
"net"
9
10
"os"
@@ -109,13 +110,13 @@ type BinlogSyncerConfig struct {
109
110
110
111
//Option function is used to set outside of BinlogSyncerConfig, between mysql connection and COM_REGISTER_SLAVE
111
112
//For MariaDB: slave_gtid_ignore_duplicates、skip_replication、slave_until_gtid
112
- Option func (* client.Conn ) error
113
+ Option func (* client.Conn ) error `json:"-"`
113
114
114
115
// Set Logger
115
116
Logger * log.Logger
116
117
117
118
// Set Dialer
118
- Dialer client.Dialer
119
+ Dialer client.Dialer `json:"-"`
119
120
}
120
121
121
122
// BinlogSyncer syncs binlog event from server.
@@ -160,8 +161,14 @@ func NewBinlogSyncer(cfg BinlogSyncerConfig) *BinlogSyncer {
160
161
161
162
// Clear the Password to avoid outputing it in log.
162
163
pass := cfg .Password
163
- cfg .Password = ""
164
- cfg .Logger .Infof ("create BinlogSyncer with config %v" , cfg )
164
+ cfg .Password = "<hidden>"
165
+ jsonCfg , err := json .Marshal (cfg )
166
+ if err != nil {
167
+ cfg .Logger .Warnf ("Failed to encode config as JSON: %s" , err )
168
+ cfg .Logger .Infof ("create BinlogSyncer with config %#v" , cfg )
169
+ }
170
+ cfg .Logger .Infof ("create BinlogSyncer with config %s" , jsonCfg )
171
+
165
172
cfg .Password = pass
166
173
167
174
b := new (BinlogSyncer )
You can’t perform that action at this time.
0 commit comments