Skip to content

Commit

Permalink
Adjust log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
kevburnsjr committed Jan 9, 2025
1 parent 7f8db32 commit 7b5ea0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion shard_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ func (c *controllerManager) LeaderUpdated(info LeaderInfo) {
if info.ShardID == 0 {
c.isLeader.Store(info.LeaderID == info.ReplicaID)
}
if c.isLeader.Load() {
if c.isLeader.Load() && c.agent.Status() == AgentStatus_Ready && info.LeaderID != 0 {
c.agent.shardLeaderSet(info.ShardID, info.LeaderID, info.Term)
c.log.Warningf("[%05d:%05d] Leader Set: %d (term %d)", info.ShardID, info.ReplicaID, info.LeaderID, info.Term)
}
}

Expand Down
11 changes: 9 additions & 2 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var (
NodeHostDir: "/var/lib/zongzi/raft",
RaftAddress: DefaultRaftAddress,
RTTMillisecond: 10,
NotifyCommit: true,
WALDir: "/var/lib/zongzi/wal",
Expert: config.ExpertConfig{
LogDBFactory: tan.Factory,
Expand All @@ -64,6 +63,7 @@ type (
ReplicaConfig = config.Config
GossipConfig = config.GossipConfig
LogDBConfig = config.LogDBConfig
EngineConfig = config.EngineConfig

LeaderInfo = raftio.LeaderInfo
RaftEventListener = raftio.IRaftEventListener
Expand All @@ -83,7 +83,11 @@ type (
ReplicaStatus string
)

var GetLogger = logger.GetLogger
var (
GetLogger = logger.GetLogger

GetDefaultEngineConfig = config.GetDefaultEngineConfig
)

const (
LogLevelCritical = logger.CRITICAL
Expand Down Expand Up @@ -269,6 +273,9 @@ func SetLogLevel(level LogLevel) {
logger.GetLogger("rsm").SetLevel(level)
logger.GetLogger("transport").SetLevel(level)
logger.GetLogger("zongzi").SetLevel(level)
logger.GetLogger("tan").SetLevel(level)
logger.GetLogger("registry").SetLevel(level)
logger.GetLogger("config").SetLevel(level)
}

// SetLogLevelDebug sets a debug log level for most loggers.
Expand Down

0 comments on commit 7b5ea0b

Please sign in to comment.