move lang.Must into logx.Must to make sure output fatal message as json

This commit is contained in:
kevin
2020-08-14 15:08:06 +08:00
parent 9d9399ad10
commit 8745039877
21 changed files with 69 additions and 70 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/tal-tech/go-zero/core/breaker"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
"gopkg.in/cheggaaa/pb.v1"
)
@@ -99,7 +100,7 @@ func main() {
gb := breaker.NewBreaker()
fp, err := os.Create("result.csv")
lang.Must(err)
logx.Must(err)
defer fp.Close()
fmt.Fprintln(fp, "seconds,state,googleCalls,netflixCalls")

View File

@@ -5,12 +5,12 @@ import (
"time"
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
)
func main() {
sub, err := discov.NewSubscriber([]string{"etcd.discovery:2379"}, "028F2C35852D", discov.Exclusive())
lang.Must(err)
logx.Must(err)
ticker := time.NewTicker(time.Second * 3)
defer ticker.Stop()

View File

@@ -9,6 +9,7 @@ import (
"time"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/threading"
"gopkg.in/cheggaaa/pb.v1"
)
@@ -119,14 +120,14 @@ func main() {
flag.Parse()
fp, err := os.Create("result.csv")
lang.Must(err)
logx.Must(err)
defer fp.Close()
fmt.Fprintln(fp, "seconds,goodOk,goodFail,goodReject,goodErrs,goodUnknowns,goodDropRatio,"+
"heavyOk,heavyFail,heavyReject,heavyErrs,heavyUnknowns,heavyDropRatio")
var gm, hm metric
dur, err := time.ParseDuration(*duration)
lang.Must(err)
logx.Must(err)
done := make(chan lang.PlaceholderType)
group := threading.NewRoutineGroup()
group.RunSafe(func() {

View File

@@ -13,7 +13,7 @@ import (
"github.com/tal-tech/go-zero/core/collection"
"github.com/tal-tech/go-zero/core/executors"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/syncx"
"gopkg.in/cheggaaa/pb.v1"
)
@@ -47,7 +47,7 @@ func main() {
lessWriter = executors.NewLessExecutor(interval * total / 100)
fp, err := os.Create("result.csv")
lang.Must(err)
logx.Must(err)
defer fp.Close()
fmt.Fprintln(fp, "second,maxFlight,flying,agressiveAvgFlying,lazyAvgFlying,bothAvgFlying")

View File

@@ -11,7 +11,7 @@ import (
"time"
"github.com/tal-tech/go-zero/core/fx"
"github.com/tal-tech/go-zero/core/lang"
"github.com/tal-tech/go-zero/core/logx"
)
var (
@@ -27,7 +27,7 @@ func main() {
flag.Parse()
fp, err := os.Create("result.csv")
lang.Must(err)
logx.Must(err)
defer fp.Close()
fmt.Fprintln(fp, "seconds,total,pass,fail,drop")