Skip to content

Commit 48b5ed5

Browse files
committed
Use short url for node state logs
1 parent 5b1a756 commit 48b5ed5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

multinode/node.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ func NewNode[
173173
func (n *node[CHAIN_ID, HEAD, RPC]) String() string {
174174
s := fmt.Sprintf("(%s)%s", Primary.String(), n.name)
175175
if n.ws != nil {
176-
s += fmt.Sprintf(":%s", n.ws.String())
176+
s += fmt.Sprintf(":%s", shortenURL(n.ws))
177177
}
178178
if n.http != nil {
179-
s += fmt.Sprintf(":%s", n.http.String())
179+
s += fmt.Sprintf(":%s", shortenURL(n.http))
180180
}
181181
return s
182182
}
@@ -349,3 +349,10 @@ func (n *node[CHAIN_ID, HEAD, RPC]) newCtx() (context.Context, context.CancelFun
349349
ctx = CtxAddHealthCheckFlag(ctx)
350350
return ctx, cancel
351351
}
352+
353+
func shortenURL(uri *url.URL) string {
354+
if uri.Scheme == "" || uri.Host == "" {
355+
return ""
356+
}
357+
return fmt.Sprintf("%s://%s", uri.Scheme, uri.Host)
358+
}

0 commit comments

Comments
 (0)