chengxilo commented on code in PR #3379:
URL: https://github.com/apache/iggy/pull/3379#discussion_r3338734515
##########
foreign/go/client/iggy_client.go:
##########
@@ -72,15 +82,24 @@ func NewIggyClient(options ...Option) (iggcon.Client,
error) {
opt(&opts)
}
+ logger := opts.logger
+ if logger == nil {
+ logger = iggcon.NopLogger()
+ }
+
+ // Prepend the logger option so transport inherits it.
+ tcpOpts := append([]tcp.Option{tcp.WithLogger(logger)},
opts.tcpOptions...)
Review Comment:
Another approach would be remove `tcp.WithLogger`, and change the signature
of `NewIggyTcpClient` to
`func NewIggyTcpClient(logger *slog.Logger, options ...Option)
*IggyTcpClient`. logger actually is not a optional parameter, we always use
`NewIggyClient` to create TCP client, and we always provide a logger to it.
This is actually better than document it. (in my opinion)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]