Skip to content

Commit

Permalink
Add debugging option to the default logger
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelsr committed Sep 9, 2023
1 parent 49fec14 commit 8a1de29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion raft/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ import (
"go.etcd.io/raft/v3/raftpb"
)

var DefaultLogger = &raft.DefaultLogger{Logger: log.New(os.Stderr, "raft", log.LstdFlags)}
var defaultLogger = &raft.DefaultLogger{Logger: log.New(os.Stderr, "raft", log.LstdFlags)}

func DefaultLogger(debug bool) raft.Logger {
if debug {
defaultLogger.EnableDebug()
}
return defaultLogger
}

func DefaultConfig() *raft.Config {
return &raft.Config{
ID: DefaultID(),
HeartbeatTick: HeartbeatTick,
ElectionTick: ElectionTick,
MaxSizePerMsg: MaxSizePerMsg,
Expand Down

0 comments on commit 8a1de29

Please sign in to comment.