From 0a1829d94e06c88eafdaa313b26c4b30c40d5798 Mon Sep 17 00:00:00 2001 From: Arseny Sazanov Date: Thu, 18 Feb 2021 01:33:17 +0300 Subject: [PATCH] Add more defaultNatsOptions and change log msgs --- nats/client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nats/client.go b/nats/client.go index c0efb63..c2d3f14 100644 --- a/nats/client.go +++ b/nats/client.go @@ -137,13 +137,16 @@ func (c *client) defaultNatsOptions() []Option { nats.ReconnectJitter(ReconnectJitterDefault, ReconnectJitterTLSDefault), nats.ReconnectWait(ReconnectWaitDefault), nats.DisconnectErrHandler(func(nc *nats.Conn, err error) { - c.log.Warn("Got disconnected", zap.Error(err)) + c.log.Warn("[DisconnectErrHandler] Disconnect", zap.Error(err)) }), nats.ReconnectHandler(func(nc *nats.Conn) { - c.log.Warn("Got reconnected", zap.String("ConnUrl", nc.ConnectedUrl())) + c.log.Warn("[ReconnectHandler] Reconnect", zap.String("ConnUrl", nc.ConnectedUrl())) }), nats.ClosedHandler(func(nc *nats.Conn) { - c.log.Warn("Connection closed", zap.Error(nc.LastError())) + c.log.Warn("[ClosedHandler] Close handler", zap.Error(nc.LastError())) + }), + nats.ErrorHandler(func(_ *nats.Conn, _ *nats.Subscription, err error) { + c.log.Warn("[ErrorHandler]", zap.Error(err)) }), } }