mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-15 11:46:11 +00:00
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:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
@@ -18,7 +19,7 @@ func main() {
|
||||
// Start the listener
|
||||
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
|
||||
if err != nil {
|
||||
common.Exit(err.Error())
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
||||
// Wait forever
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -8,7 +10,6 @@ import (
|
||||
"github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/server"
|
||||
"github.com/tendermint/abci/types"
|
||||
common "github.com/tendermint/go-common"
|
||||
)
|
||||
|
||||
func TestChainAware(t *testing.T) {
|
||||
@@ -25,7 +26,7 @@ func TestChainAware(t *testing.T) {
|
||||
// Connect to the socket
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
common.Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||
log.Fatal(fmt.Sprintf("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
client.Start()
|
||||
defer client.Stop()
|
||||
|
||||
@@ -136,7 +136,7 @@ func LoadLastBlock(db dbm.DB) (lastBlock LastBlockInfo) {
|
||||
wire.ReadBinaryPtr(&lastBlock, r, 0, n, err)
|
||||
if *err != nil {
|
||||
// DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
|
||||
common.Exit(fmt.Sprintf("Data has been corrupted or its spec has changed: %v\n", *err))
|
||||
log.Crit(fmt.Sprintf("Data has been corrupted or its spec has changed: %v\n", *err))
|
||||
}
|
||||
// TODO: ensure that buf is completely read.
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"reflect"
|
||||
"testing"
|
||||
@@ -41,14 +42,14 @@ func testStream(t *testing.T, app types.Application) {
|
||||
// Start the listener
|
||||
server, err := server.NewSocketServer("unix://test.sock", app)
|
||||
if err != nil {
|
||||
common.Exit(fmt.Sprintf("Error starting socket server: %v", err.Error()))
|
||||
log.Fatal(fmt.Sprintf("Error starting socket server: %v", err.Error()))
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
common.Exit(fmt.Sprintf("Error starting socket client: %v", err.Error()))
|
||||
log.Fatal(fmt.Sprintf("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
client.Start()
|
||||
defer client.Stop()
|
||||
@@ -104,7 +105,7 @@ func testStream(t *testing.T, app types.Application) {
|
||||
// test grpc
|
||||
|
||||
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
|
||||
return Connect(addr)
|
||||
return common.Connect(addr)
|
||||
}
|
||||
|
||||
func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
|
||||
@@ -114,14 +115,14 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
|
||||
// Start the listener
|
||||
server, err := server.NewGRPCServer("unix://test.sock", app)
|
||||
if err != nil {
|
||||
common.Exit(fmt.Sprintf("Error starting GRPC server: %v", err.Error()))
|
||||
log.Fatal(fmt.Sprintf("Error starting GRPC server: %v", err.Error()))
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
conn, err := grpc.Dial("unix://test.sock", grpc.WithInsecure(), grpc.WithDialer(dialerFunc))
|
||||
if err != nil {
|
||||
common.Exit(fmt.Sprintf("Error dialing GRPC server: %v", err.Error()))
|
||||
log.Fatal(fmt.Sprintf("Error dialing GRPC server: %v", err.Error()))
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user