Skip to content

Commit

Permalink
Add additional debug logging around gateway subscription.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Apr 18, 2022
1 parent db0b7ed commit 3d0c7b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/integration/mqtt/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ func (b *Backend) SetGatewaySubscription(subscribe bool, gatewayID lorawan.EUI64
delete(b.gateways, gatewayID)
}

log.WithFields(log.Fields{
"gateway_id": gatewayID,
"subscribe": subscribe,
}).Debug("integration/mqtt: gateway subscription set")

return nil
}

Expand All @@ -288,6 +293,12 @@ func (b *Backend) subscribeGateway(gatewayID lorawan.EUI64) error {
if token := b.conn.Subscribe(topic.String(), b.qos, b.handleCommand); token.WaitTimeout(b.maxTokenWait) && token.Error() != nil {
return errors.Wrap(token.Error(), "subscribe topic error")
}

log.WithFields(log.Fields{
"topic": topic.String(),
"qos": b.qos,
}).Debug("integration/mqtt: subscribed to topic")

return nil
}

Expand All @@ -304,6 +315,10 @@ func (b *Backend) unsubscribeGateway(gatewayID lorawan.EUI64) error {
return errors.Wrap(token.Error(), "unsubscribe topic error")
}

log.WithFields(log.Fields{
"topic": topic.String(),
}).Debug("integration/mqtt: unsubscribed from topic")

return nil
}

Expand Down

0 comments on commit 3d0c7b8

Please sign in to comment.