Skip to content

Commit

Permalink
clean up set logger
Browse files Browse the repository at this point in the history
  • Loading branch information
lalexgap committed Aug 21, 2023
1 parent c5fe0bc commit 39dd851
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func InitChainServiceAndRunRpcServer(pkString string, chainOpts chain.ChainOpts,
return nil, nil, nil, err
}

slog.Info("Nitro as a Service listening", "rpc-port", rpcPort, "msg-port", msgPort, "transport", transportType)
slog.Info("Nitro as a Service listening", "rpc-port", rpcPort, "msg-port", msgPort, "transport", transportType, "address", node.Address.String())

return rpcServer, node, messageService, nil
}
Expand Down
9 changes: 2 additions & 7 deletions node_test/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ func simpleOutcome(a, b types.Address, aBalance, bBalance uint) outcome.Exit {
return testdata.Outcomes.Create(a, b, aBalance, bBalance, types.Address{})
}

func setLogger(logDestination *os.File, clientAddress *types.Address, rpcRole string) {
h := slog.NewJSONHandler(logDestination, &slog.HandlerOptions{Level: slog.LevelDebug})
slog.SetDefault(slog.New(h).With("rpc", rpcRole, "address", clientAddress))
}

func TestRpcWithNats(t *testing.T) {
for _, n := range []int{2, 3, 4} {
executeNRpcTestWrapper(t, "nats", n, false)
Expand Down Expand Up @@ -403,8 +398,8 @@ func setupNitroNodeWithRPCClient(
if err != nil {
t.Fatal(err)
}

setLogger(logDestination, rpcServer.Address(), "client")
h := slog.NewJSONHandler(logDestination, &slog.HandlerOptions{Level: slog.LevelDebug})
slog.SetDefault(slog.New(h))

var clientConnection transport.Requester
switch connectionType {
Expand Down

0 comments on commit 39dd851

Please sign in to comment.