Remove fmt.Println and add Zerolog logging system
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m2s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m2s
This commit is contained in:
@@ -3,23 +3,26 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("missing JSON file path")
|
||||
log.Error().Msg("missing JSON file path")
|
||||
return
|
||||
}
|
||||
conn, err := grpc.Dial("dns:///localhost:8090", grpc.WithInsecure(), grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Panic().Err(err).Msg("Cannot dial local server")
|
||||
}
|
||||
|
||||
client := grpcapi.NewMobilityAccountsClient(conn)
|
||||
@@ -46,5 +49,5 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(string(jsonresponse))
|
||||
log.Debug().Str("response", string(jsonresponse)).Msg("JSOn response")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user