cleanup: replace common.Exit with log.Crit or log.Fatal

Later we can pick another logger that has fatal, like zap?
This commit is contained in:
Tzu-Jung Lee
2017-01-16 23:23:19 -08:00
parent 1150bbfe36
commit 9134905f42
10 changed files with 28 additions and 21 deletions
+5 -4
View File
@@ -3,6 +3,7 @@ package main
import (
"bufio"
"fmt"
"log"
"github.com/tendermint/abci/types"
common "github.com/tendermint/go-common"
@@ -12,7 +13,7 @@ func main() {
conn, err := common.Connect("unix://test.sock")
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
// Read a bunch of responses
@@ -22,7 +23,7 @@ func main() {
var res = &types.Response{}
err := types.ReadMessage(conn, res)
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
counter += 1
if counter%1000 == 0 {
@@ -39,11 +40,11 @@ func main() {
err := types.WriteMessage(req, bufWriter)
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
err = bufWriter.Flush()
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
counter += 1
+3 -2
View File
@@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"fmt"
"log"
"net"
"reflect"
@@ -15,7 +16,7 @@ func main() {
conn, err := common.Connect("unix://test.sock")
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
// Make a bunch of requests
@@ -24,7 +25,7 @@ func main() {
req := types.ToRequestEcho("foobar")
_, err := makeRequest(conn, req)
if err != nil {
common.Exit(err.Error())
log.Fatal(err.Error())
}
counter += 1
if counter%1000 == 0 {