From 97172be5c2a8bbea14fc739119bc2d73e65f5868 Mon Sep 17 00:00:00 2001
From: capossele <angelocapossele@gmail.com>
Date: Tue, 17 Dec 2019 12:28:07 +0000
Subject: [PATCH] :rotating_light: changes debug level

---
 .gitignore                         |  1 +
 plugins/autopeering/autopeering.go | 47 +++++++++++++++---------------
 plugins/gossip/gossip.go           |  4 +--
 runNetwork.sh                      |  2 +-
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/.gitignore b/.gitignore
index 217c41d9..52422ce9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 # Logs
 logs/*
 testNodes/*
+*.log
 
 # Project files
 .idea
diff --git a/plugins/autopeering/autopeering.go b/plugins/autopeering/autopeering.go
index f980e91c..7dc06d78 100644
--- a/plugins/autopeering/autopeering.go
+++ b/plugins/autopeering/autopeering.go
@@ -7,7 +7,6 @@ import (
 	"net"
 	"net/http"
 	"strconv"
-	"time"
 
 	"github.com/iotaledger/autopeering-sim/discover"
 	"github.com/iotaledger/autopeering-sim/logger"
@@ -23,7 +22,7 @@ import (
 )
 
 var (
-	debugLevel = "debug"
+	debugLevel = "info"
 	close      = make(chan struct{}, 1)
 	srv        *server.Server
 	Discovery  *discover.Protocol
@@ -33,7 +32,7 @@ var (
 const defaultZLC = `{
 	"level": "info",
 	"development": false,
-	"outputPaths": ["stdout"],
+	"outputPaths": ["./autopeering.log"],
 	"errorOutputPaths": ["stderr"],
 	"encoding": "console",
 	"encoderConfig": {
@@ -151,12 +150,12 @@ func start() {
 	}()
 
 	// Only for debug
-	go func() {
-		for t := range time.NewTicker(2 * time.Second).C {
-			_ = t
-			printReport(zLogger)
-		}
-	}()
+	// go func() {
+	// 	for t := range time.NewTicker(2 * time.Second).C {
+	// 		_ = t
+	// 		printReport(zLogger)
+	// 	}
+	// }()
 
 	<-close
 }
@@ -176,18 +175,18 @@ func getMyIP() string {
 }
 
 // used only for debugging puropose
-func printReport(log *zap.SugaredLogger) {
-	if Discovery == nil || Selection == nil {
-		return
-	}
-	knownPeers := Discovery.GetVerifiedPeers()
-	incoming := []*peer.Peer{}
-	outgoing := []*peer.Peer{}
-	if Selection != nil {
-		incoming = Selection.GetIncomingNeighbors()
-		outgoing = Selection.GetOutgoingNeighbors()
-	}
-	log.Info("Known peers:", len(knownPeers))
-	log.Info("Chosen:", len(outgoing))
-	log.Info("Accepted:", len(incoming))
-}
+// func printReport(log *zap.SugaredLogger) {
+// 	if Discovery == nil || Selection == nil {
+// 		return
+// 	}
+// 	knownPeers := Discovery.GetVerifiedPeers()
+// 	incoming := []*peer.Peer{}
+// 	outgoing := []*peer.Peer{}
+// 	if Selection != nil {
+// 		incoming = Selection.GetIncomingNeighbors()
+// 		outgoing = Selection.GetOutgoingNeighbors()
+// 	}
+// 	log.Info("Known peers:", len(knownPeers))
+// 	log.Info("Chosen:", len(outgoing))
+// 	log.Info("Accepted:", len(incoming))
+// }
diff --git a/plugins/gossip/gossip.go b/plugins/gossip/gossip.go
index 48800c44..64e5b778 100644
--- a/plugins/gossip/gossip.go
+++ b/plugins/gossip/gossip.go
@@ -18,7 +18,7 @@ import (
 const defaultZLC = `{
 	"level": "info",
 	"development": false,
-	"outputPaths": ["stdout"],
+	"outputPaths": ["./gossip.log"],
 	"errorOutputPaths": ["stderr"],
 	"encoding": "console",
 	"encoderConfig": {
@@ -37,7 +37,7 @@ const defaultZLC = `{
   }`
 
 var (
-	debugLevel = "debug"
+	debugLevel = "info"
 	zLogger    *zap.SugaredLogger
 	mgr        *gp.Manager
 )
diff --git a/runNetwork.sh b/runNetwork.sh
index a9e84ee5..daa942e4 100755
--- a/runNetwork.sh
+++ b/runNetwork.sh
@@ -27,6 +27,6 @@ for i in `seq 1 $1`; do
     mkdir node_$i/logs
     cp ../shimmer node_$i/
     cd node_$i
-    ./shimmer --autopeering.port $PEERING_PORT --gossip.port $GOSSIP_PORT --autopeering.address 127.0.0.1 --autopeering.entryNodes 6rtO4nW2nzbSqZ8nrf0VFOn+fuyluf6ltJTkKpUc3LM=@127.0.0.1:14626 --node.LogLevel 4 --node.disablePlugins statusscreen --analysis.serverAddress 127.0.0.1:188 &
+    ./shimmer --autopeering.port $PEERING_PORT --gossip.port $GOSSIP_PORT --autopeering.address 127.0.0.1 --autopeering.entryNodes 2TwlC5mtYVrCHNKG8zkFWmEUlL0pJPS1DOOC2U4yjwo=@127.0.0.1:14626 --node.LogLevel 4 --node.disablePlugins statusscreen --analysis.serverAddress 127.0.0.1:188 &
     cd ..
 done
\ No newline at end of file
-- 
GitLab