Skip to content

Commit

Permalink
improve log
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetancollaud committed Feb 3, 2024
1 parent af62c78 commit 0a68592
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/mqtt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ func NewClient(options *ClientOptions) Client {
SetUsername(options.Username).
SetPassword(options.Password).
SetAutoReconnect(true).
SetReconnectingHandler(func(client mqtt.Client, options *mqtt.ClientOptions) {
log.Info().Msg("Reconnecting to MQTT server.")
SetReconnectingHandler(func(client mqtt.Client, opts *mqtt.ClientOptions) {
log.Info().Str("url", options.MqttUrl).Msg("Reconnecting to MQTT server.")
}).
SetOnConnectHandler(func(client mqtt.Client) {
log.Info().Str("url", options.MqttUrl).Msg("Connected to MQTT server.")
})

return &client{
Expand Down

0 comments on commit 0a68592

Please sign in to comment.