Improved logging
This commit is contained in:
1 parent
edb18eebe0
commit
6374562137
1 file changed
+1
@@ -50,6 +50,7 @@ func NewClient(logger *zap.Logger, config *config.Config, csvHelper *csv.Helper)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StartListening(logger *zap.Logger, config *config.Config, client mqtt.Client) {
|
func StartListening(logger *zap.Logger, config *config.Config, client mqtt.Client) {
|
||||||
|
logger.Info("Subscribing to", zap.Int("topics", len(config.Topics)))
|
||||||
for _, topic := range config.Topics {
|
for _, topic := range config.Topics {
|
||||||
if token := client.Subscribe(topic, 0, nil); token.Wait() && token.Error() != nil {
|
if token := client.Subscribe(topic, 0, nil); token.Wait() && token.Error() != nil {
|
||||||
logger.Error("error subscribing to topic", zap.String("topic", topic), zap.Error(token.Error()))
|
logger.Error("error subscribing to topic", zap.String("topic", topic), zap.Error(token.Error()))
|
||||||
|
|||||||
Reference in new issue
Block a user