Skip to content

Commit 3d0c7b8

Browse files
committed
Add additional debug logging around gateway subscription.
1 parent db0b7ed commit 3d0c7b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/integration/mqtt/backend.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ func (b *Backend) SetGatewaySubscription(subscribe bool, gatewayID lorawan.EUI64
272272
delete(b.gateways, gatewayID)
273273
}
274274

275+
log.WithFields(log.Fields{
276+
"gateway_id": gatewayID,
277+
"subscribe": subscribe,
278+
}).Debug("integration/mqtt: gateway subscription set")
279+
275280
return nil
276281
}
277282

@@ -288,6 +293,12 @@ func (b *Backend) subscribeGateway(gatewayID lorawan.EUI64) error {
288293
if token := b.conn.Subscribe(topic.String(), b.qos, b.handleCommand); token.WaitTimeout(b.maxTokenWait) && token.Error() != nil {
289294
return errors.Wrap(token.Error(), "subscribe topic error")
290295
}
296+
297+
log.WithFields(log.Fields{
298+
"topic": topic.String(),
299+
"qos": b.qos,
300+
}).Debug("integration/mqtt: subscribed to topic")
301+
291302
return nil
292303
}
293304

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

318+
log.WithFields(log.Fields{
319+
"topic": topic.String(),
320+
}).Debug("integration/mqtt: unsubscribed from topic")
321+
307322
return nil
308323
}
309324

0 commit comments

Comments
 (0)