Remove fmt.Println and add Zerolog logging system
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m2s

This commit is contained in:
2024-11-11 20:35:17 +01:00
parent 4ae6aa7a90
commit 5e4cea0bb3
11 changed files with 88 additions and 55 deletions

View File

@@ -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")
}