From 76d9d89aff230895dd3bb1171085eb85633fcbc3 Mon Sep 17 00:00:00 2001
From: Juan Batiz-Benet <juan@benet.ai>
Date: Sat, 24 Jan 2015 16:22:14 -0800
Subject: [PATCH] user friendliness in logs + output

---
 cmd/ipfs/daemon.go            | 1 +
 cmd/ipfs/init.go              | 1 -
 core/bootstrap.go             | 4 ++--
 core/core.go                  | 2 +-
 p2p/net/swarm/swarm_dial.go   | 4 ++--
 p2p/protocol/identify/id.go   | 6 +++---
 test/sharness/t0020-init.sh   | 2 +-
 test/sharness/t0060-daemon.sh | 2 +-
 test/sharness/t0080-repo.sh   | 8 ++++----
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go
index 94a6fb2f0..05d86e454 100644
--- a/cmd/ipfs/daemon.go
+++ b/cmd/ipfs/daemon.go
@@ -49,6 +49,7 @@ the daemon.
 
 func daemonFunc(req cmds.Request, res cmds.Response) {
 
+	fmt.Println("Initializing daemon...")
 	// first, whether user has provided the initialization flag. we may be
 	// running in an uninitialized state.
 	initialize, _, err := req.Option(initOptionKwd).Bool()
diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go
index 417b5f3de..ce8842696 100644
--- a/cmd/ipfs/init.go
+++ b/cmd/ipfs/init.go
@@ -80,7 +80,6 @@ var welcomeMsg = `Hello and Welcome to IPFS!
 If you're seeing this, you have successfully installed
 IPFS and are now interfacing with the ipfs merkledag!
 
-For a short demo of what you can do, enter 'ipfs tour'
 `
 
 func initWithDefaults(repoRoot string) error {
diff --git a/core/bootstrap.go b/core/bootstrap.go
index 84bf8e652..159e683dc 100644
--- a/core/bootstrap.go
+++ b/core/bootstrap.go
@@ -92,7 +92,7 @@ func Bootstrap(n *IpfsNode, cfg BootstrapConfig) (io.Closer, error) {
 
 		if err := bootstrapRound(ctx, n.PeerHost, thedht, n.Peerstore, cfg); err != nil {
 			log.Event(ctx, "bootstrapError", n.Identity, lgbl.Error(err))
-			log.Errorf("%s bootstrap error: %s", n.Identity, err)
+			log.Debugf("%s bootstrap error: %s", n.Identity, err)
 		}
 	}
 
@@ -187,7 +187,7 @@ func bootstrapConnect(ctx context.Context,
 			err := route.Connect(ctx, p.ID)
 			if err != nil {
 				log.Event(ctx, "bootstrapDialFailed", p.ID)
-				log.Errorf("failed to bootstrap with %v: %s", p.ID, err)
+				log.Debugf("failed to bootstrap with %v: %s", p.ID, err)
 				errs <- err
 				return
 			}
diff --git a/core/core.go b/core/core.go
index c06535a1f..a293f2199 100644
--- a/core/core.go
+++ b/core/core.go
@@ -308,7 +308,7 @@ func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error {
 			bpeers := n.Repo.Config().Bootstrap
 			ps, err := toPeerInfos(bpeers)
 			if err != nil {
-				log.Error("failed to parse bootstrap peers from config: %s", bpeers)
+				log.Warningf("failed to parse bootstrap peers from config: %s", bpeers)
 				return nil
 			}
 			return ps
diff --git a/p2p/net/swarm/swarm_dial.go b/p2p/net/swarm/swarm_dial.go
index a14321445..1590b7193 100644
--- a/p2p/net/swarm/swarm_dial.go
+++ b/p2p/net/swarm/swarm_dial.go
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
 	// ok try to setup the new connection.
 	swarmC, err := dialConnSetup(ctx, s, connC)
 	if err != nil {
-		log.Error("Dial newConnSetup failed. disconnecting.")
+		log.Debug("Dial newConnSetup failed. disconnecting.")
 		log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
 		connC.Close() // close the connection. didn't work out :(
 		return nil, err
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
 	// ok try to setup the new connection. (newConnSetup will add to group)
 	swarmC, err := s.newConnSetup(ctx, psC)
 	if err != nil {
-		log.Error("Dial newConnSetup failed. disconnecting.")
+		log.Debug("Dial newConnSetup failed. disconnecting.")
 		log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
 		psC.Close() // we need to make sure psC is Closed.
 		return nil, err
diff --git a/p2p/protocol/identify/id.go b/p2p/protocol/identify/id.go
index a8cd5329a..c63e8c01b 100644
--- a/p2p/protocol/identify/id.go
+++ b/p2p/protocol/identify/id.go
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
 
 		// ok give the response to our handler.
 		if err := protocol.WriteHeader(s, ID); err != nil {
-			log.Error("error writing stream header for %s", ID)
+			log.Debugf("error writing stream header for %s", ID)
 			log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer())
 		}
 		ids.ResponseHandler(s)
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
 	r := ggio.NewDelimitedReader(s, 2048)
 	mes := pb.Identify{}
 	if err := r.ReadMsg(&mes); err != nil {
-		log.Errorf("%s error receiving message from %s %s %s", ID,
+		log.Debugf("%s error receiving message from %s %s %s", ID,
 			c.RemotePeer(), c.RemoteMultiaddr(), err)
 		return
 	}
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
 	for _, addr := range laddrs {
 		maddr, err := ma.NewMultiaddrBytes(addr)
 		if err != nil {
-			log.Errorf("%s failed to parse multiaddr from %s %s", ID,
+			log.Debugf("%s failed to parse multiaddr from %s %s", ID,
 				p, c.RemoteMultiaddr())
 			continue
 		}
diff --git a/test/sharness/t0020-init.sh b/test/sharness/t0020-init.sh
index 29cd70063..7d6ae9a33 100755
--- a/test/sharness/t0020-init.sh
+++ b/test/sharness/t0020-init.sh
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
 '
 
 test_expect_success "ipfs init output looks good" '
-	STARTHASH="QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB" &&
+	STARTHASH="QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ" &&
 	echo "initializing ipfs node at $IPFS_PATH" >expected &&
 	echo "generating 4096-bit RSA keypair...done" >>expected &&
 	echo "peer identity: $PEERID" >>expected &&
diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh
index 32a6b2aad..cec75c6d6 100755
--- a/test/sharness/t0060-daemon.sh
+++ b/test/sharness/t0060-daemon.sh
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
 
 # note this is almost the same as t0020-init.sh "ipfs init output looks good"
 test_expect_success "ipfs daemon output looks good" '
-  STARTHASH="QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB" &&
+  STARTHASH="QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ" &&
   echo "initializing ipfs node at $IPFS_PATH" >expected &&
   echo "generating key pair...done" >>expected &&
   echo "peer identity: $PEERID" >>expected &&
diff --git a/test/sharness/t0080-repo.sh b/test/sharness/t0080-repo.sh
index 4280ccedc..43783bf86 100755
--- a/test/sharness/t0080-repo.sh
+++ b/test/sharness/t0080-repo.sh
@@ -43,7 +43,7 @@ test_expect_success "'ipfs pin rm' succeeds" '
 
 test_expect_success "file no longer pinned" '
 	# we expect the welcome file to show up here
-	echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB > expected2
+	echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ > expected2
 	ipfs pin ls -type=recursive > actual2
 	test_cmp expected2 actual2
 '
@@ -84,8 +84,8 @@ test_expect_success "'ipfs repo gc' removes file" '
 '
 
 test_expect_success "'ipfs refs local' no longer shows file" '
-	echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > expected8
-	echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> expected8
+	echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ > expected8
+	echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >> expected8
 	ipfs refs local > actual8
 	test_cmp expected8 actual8
 '
@@ -123,7 +123,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
 
 test_expect_success "'ipfs pin ls -type=recursive' is correct" '
 	echo $MBLOCKHASH > rp_expected
-	echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> rp_expected
+	echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ >> rp_expected
 	cat rp_expected | sort > rp_exp_sorted
 	ipfs pin ls -type=recursive | sort > rp_actual
 	test_cmp rp_exp_sorted rp_actual
-- 
GitLab