File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
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"
@@ -111,15 +112,15 @@ type BinlogSyncerConfig struct {
111
112
112
113
//Option function is used to set outside of BinlogSyncerConfig, between mysql connection and COM_REGISTER_SLAVE
113
114
//For MariaDB: slave_gtid_ignore_duplicates、skip_replication、slave_until_gtid
114
- Option func (* client.Conn ) error
115
+ Option func (* client.Conn ) error `json:"-"`
115
116
116
117
// Set Logger
117
118
Logger loggers.Advanced
118
119
119
120
// Set Dialer
120
- Dialer client.Dialer
121
+ Dialer client.Dialer `json:"-"`
121
122
122
- RowsEventDecodeFunc func (* RowsEvent , []byte ) error
123
+ RowsEventDecodeFunc func (* RowsEvent , []byte ) error `json:"-"`
123
124
124
125
DiscardGTIDSet bool
125
126
}
@@ -169,8 +170,14 @@ func NewBinlogSyncer(cfg BinlogSyncerConfig) *BinlogSyncer {
169
170
170
171
// Clear the Password to avoid outputing it in log.
171
172
pass := cfg .Password
172
- cfg .Password = ""
173
- cfg .Logger .Infof ("create BinlogSyncer with config %v" , cfg )
173
+ cfg .Password = "<hidden>"
174
+ jsonCfg , err := json .Marshal (cfg )
175
+ if err != nil {
176
+ cfg .Logger .Warnf ("Failed to encode config as JSON: %s" , err )
177
+ cfg .Logger .Infof ("create BinlogSyncer with config %#v" , cfg )
178
+ }
179
+ cfg .Logger .Infof ("create BinlogSyncer with config %s" , jsonCfg )
180
+
174
181
cfg .Password = pass
175
182
176
183
b := new (BinlogSyncer )
You can’t perform that action at this time.
0 commit comments