Skip to content

Commit 0baad4d

Browse files
b13fsiddontang
authored andcommitted
Add LogLevel in BinLogSyncerConfig (go-mysql-org#129)
1 parent 3fef065 commit 0baad4d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

replication/binlogsyncer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ type BinlogSyncerConfig struct {
5252
// Use replication.Time structure for timestamp and datetime.
5353
// We will use Local location for timestamp and UTC location for datatime.
5454
ParseTime bool
55+
56+
LogLevel string
5557
}
5658

5759
// BinlogSyncer syncs binlog event from server.
@@ -76,6 +78,11 @@ type BinlogSyncer struct {
7678

7779
// NewBinlogSyncer creates the BinlogSyncer with cfg.
7880
func NewBinlogSyncer(cfg *BinlogSyncerConfig) *BinlogSyncer {
81+
if cfg.LogLevel == "" {
82+
cfg.LogLevel = "info"
83+
}
84+
log.SetLevelByString(cfg.LogLevel)
85+
7986
log.Infof("create BinlogSyncer with config %v", cfg)
8087

8188
b := new(BinlogSyncer)

0 commit comments

Comments
 (0)