Skip to content

Commit 915fdfe

Browse files
committed
feat: change log level from Info to Debug for various log messages to reduce verbosity
1 parent bcefecc commit 915fdfe

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

cluster/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ func (cluster *Cluster) InitFromConf() {
461461

462462
//working directory of the cluster is working directory of server and cluster name
463463
if _, err := os.Stat(cluster.WorkingDir); os.IsNotExist(err) {
464-
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, config.LvlInfo, "Creating directory %s", cluster.WorkingDir)
464+
cluster.LogModulePrintf(cluster.Conf.Verbose, config.ConstLogModGeneral, config.LvlDbg, "Creating directory %s", cluster.WorkingDir)
465465
os.MkdirAll(cluster.WorkingDir, os.ModePerm)
466466
}
467467

config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ func (conf *Config) GenerateKey(Logger *logrus.Logger) error {
16921692
_, err := os.Stat(conf.MonitoringKeyPath)
16931693
// Check if the file does not exist
16941694
if err == nil {
1695-
Logger.Infof("Repman discovered that key is already generated. Using existing key.")
1695+
Logger.Debugf("Repman discovered that key is already generated. Using existing key.")
16961696
return nil
16971697
} else {
16981698
if !os.IsNotExist(err) {
@@ -1703,16 +1703,16 @@ func (conf *Config) GenerateKey(Logger *logrus.Logger) error {
17031703
newdir := "/home/repman/.config/replication-manager/etc"
17041704
newpath := newdir + "/.replication-manager.key"
17051705

1706-
Logger.Infof("Key not found. Checking in extra path : %s", newpath)
1706+
Logger.Debugf("Key not found. Checking in extra path : %s", newpath)
17071707

17081708
_, err = os.Stat(newpath)
17091709
if err == nil {
1710-
Logger.Infof("Repman discovered key in alternative path. Using existing key on %s", newpath)
1710+
Logger.Debugf("Repman discovered key in alternative path. Using existing key on %s", newpath)
17111711
conf.MonitoringKeyPath = newpath
17121712
return nil
17131713
} else {
17141714

1715-
Logger.Infof("Key not found. Generating : %s", conf.MonitoringKeyPath)
1715+
Logger.Debugf("Key not found. Generating : %s", conf.MonitoringKeyPath)
17161716

17171717
if err = misc.TryOpenFile(conf.MonitoringKeyPath, os.O_WRONLY|os.O_CREATE, 0600, true); err != nil && conf.WithEmbed == "OFF" {
17181718
newdir := "/home/repman/.config/replication-manager/etc"

server/server.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
13801380
// Proceed include files
13811381
//if include is defined in a config file
13821382
if fistRead.GetString("default.include") != "" {
1383-
repman.Logrus.Info("Reading default section include directory: " + fistRead.GetString("default.include"))
1383+
repman.Logrus.Debug("Reading default section include directory: " + fistRead.GetString("default.include"))
13841384

13851385
if _, err := os.Stat(fistRead.GetString("default.include")); os.IsNotExist(err) {
13861386
repman.Logrus.Warning("Include config directory does not exist " + conf.Include)
@@ -1392,7 +1392,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
13921392
//load files from the include path
13931393
files, err := os.ReadDir(conf.ClusterConfigPath)
13941394
if err != nil {
1395-
repman.Logrus.Infof("No config include directory %s ", conf.ClusterConfigPath)
1395+
repman.Logrus.Debugf("No config include directory %s ", conf.ClusterConfigPath)
13961396
}
13971397
//read and set config from all files in the include path
13981398
for _, f := range files {
@@ -1416,7 +1416,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
14161416
}
14171417
}
14181418
} else {
1419-
repman.Logrus.Warning("No include directory in default section")
1419+
repman.Logrus.Debug("No include directory in default section")
14201420
}
14211421

14221422
repman.ImmutableClusterList = strings.Split(repman.DiscoverClusters(fistRead), ",")
@@ -1454,11 +1454,11 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
14541454
files, err := os.ReadDir(conf.WorkingDir)
14551455
//load files from the working dir
14561456
if err != nil {
1457-
repman.Logrus.Infof("No working directory %s ", conf.WorkingDir)
1457+
repman.Logrus.Debugf("No working directory %s ", conf.WorkingDir)
14581458
}
14591459
// Preserve dynamic config after restart
14601460
if _, err := os.Stat(conf.WorkingDir + "/default.toml"); os.IsNotExist(err) {
1461-
repman.Logrus.Infof("No monitoring overwrite default config found %s", conf.WorkingDir+"/default.toml")
1461+
repman.Logrus.Debugf("No monitoring overwrite default config found %s", conf.WorkingDir+"/default.toml")
14621462
} else {
14631463
fistRead.SetConfigFile(conf.WorkingDir + "/default.toml")
14641464
err = fistRead.MergeInConfig()
@@ -1489,7 +1489,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
14891489
dynRead.SetConfigName("overwrite-" + f.Name())
14901490
if _, err := os.Stat(conf.WorkingDir + "/" + f.Name() + "/" + f.Name() + ".toml"); os.IsNotExist(err) || f.Name() == "overwrite" {
14911491
if f.Name() != "overwrite" {
1492-
repman.Logrus.Warning("No monitoring saved config found " + conf.WorkingDir + "/" + f.Name() + "/" + f.Name() + ".toml")
1492+
repman.Logrus.Debug("No monitoring saved config found " + conf.WorkingDir + "/" + f.Name() + "/" + f.Name() + ".toml")
14931493
}
14941494

14951495
} else {
@@ -1505,7 +1505,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
15051505

15061506
//to read and set cloud18.toml config file if exist
15071507
if _, err := os.Stat(conf.WorkingDir + "/.pull/cloud18.toml"); os.IsNotExist(err) {
1508-
repman.Logrus.Infof("No cloud18 config found %s", conf.WorkingDir+"/.pull/cloud18.toml")
1508+
repman.Logrus.Debugf("No cloud18 config found %s", conf.WorkingDir+"/.pull/cloud18.toml")
15091509
} else {
15101510
tmp_read.SetConfigFile(conf.WorkingDir + "/.pull/cloud18.toml")
15111511
err := tmp_read.MergeInConfig()
@@ -1526,7 +1526,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
15261526
if strClusters == "" {
15271527
// Discovering the clusters from all merged conf files build clusterDiscovery map
15281528
strClusters = repman.DiscoverClusters(fistRead)
1529-
repman.Logrus.WithField("clusters", strClusters).Infof("Clusters discovered: %s", strClusters)
1529+
repman.Logrus.WithField("clusters", strClusters).Debugf("Clusters discovered: %s", strClusters)
15301530
}
15311531

15321532
cfgGroupIndex = 0
@@ -1551,7 +1551,7 @@ func (repman *ReplicationManager) InitConfig(conf config.Config, init_git bool)
15511551

15521552
//cf4 := repman.CleanupDynamicConfig(clustImmuableMap, cf3)
15531553
if cf3 == nil {
1554-
repman.Logrus.WithField("group", "default").Info("Could not parse saved configuration group")
1554+
repman.Logrus.WithField("group", "default").Debug("Could not parse saved configuration group")
15551555
} else {
15561556
for _, f := range cf3.AllKeys() {
15571557
v, ok := ImmuableMap[f]
@@ -1673,7 +1673,7 @@ func (repman *ReplicationManager) GetClusterConfig(fistRead *viper.Viper, Immuab
16731673
cf2 := fistRead.Sub(cluster)
16741674

16751675
if cf2 == nil {
1676-
repman.Logrus.WithField("group", cluster).Infof("Could not parse configuration group")
1676+
repman.Logrus.WithField("group", cluster).Debugf("Could not parse configuration group")
16771677
} else {
16781678
cf2.AutomaticEnv()
16791679
cf2.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
@@ -1709,7 +1709,7 @@ func (repman *ReplicationManager) GetClusterConfig(fistRead *viper.Viper, Immuab
17091709

17101710
//cf4 := repman.CleanupDynamicConfig(clustImmuableMap, cf3)
17111711
if cf3 == nil {
1712-
repman.Logrus.WithField("group", cluster).Info("Could not parse saved configuration group")
1712+
repman.Logrus.WithField("group", cluster).Debug("Could not parse saved configuration group")
17131713
} else {
17141714
for _, f := range cf3.AllKeys() {
17151715
v, ok := clustImmuableMap[f]
@@ -2413,7 +2413,7 @@ func (repman *ReplicationManager) StartCluster(clusterName string) (*cluster.Clu
24132413
myClusterConf.ImmuableFlagMap = repman.ImmuableFlagMaps[clusterName]
24142414
myClusterConf.DynamicFlagMap = repman.DynamicFlagMaps[clusterName]
24152415
myClusterConf.DefaultFlagMap = repman.DefaultFlagMap
2416-
repman.Logrus.Infof("Starting cluster: %s workingdir %s", clusterName, myClusterConf.WorkingDir)
2416+
repman.LogModulePrintf(repman.Conf.Verbose, config.ConstLogModGeneral, config.LvlDbg, "Starting cluster: %s workingdir %s", clusterName, myClusterConf.WorkingDir)
24172417

24182418
repman.VersionConfs[clusterName].ConfInit = myClusterConf
24192419
//log.Infof("Default config for %s workingdir:\n %v", clusterName, myClusterConf.DefaultFlagMap)

server/server_monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ For interacting with this daemon use,
9191
err := RepMan.MergeOnStart(conf)
9292
if err != nil {
9393
if err.Error() == ConfigMergeInactive {
94-
RepMan.LogModulePrintf(RepMan.Conf.Verbose, config.ConstLogModGeneral, config.LvlInfo, ConfigMergeInactive)
94+
RepMan.LogModulePrintf(RepMan.Conf.Verbose, config.ConstLogModGeneral, config.LvlDbg, ConfigMergeInactive)
9595
} else {
9696
RepMan.LogModulePrintf(RepMan.Conf.Verbose, config.ConstLogModGeneral, config.LvlErr, err.Error())
9797
}

0 commit comments

Comments
 (0)