Better logging for MQTT consumer

This commit is contained in:
chaton78 2016-04-13 23:06:30 -04:00
parent edf04d788a
commit fd0b41fd01
1 changed files with 2 additions and 1 deletions

View File

@ -133,6 +133,7 @@ func (m *MQTTConsumer) Start(acc telegraf.Accumulator) error {
return nil
}
func (m *MQTTConsumer) onConnect(c mqtt.Client) {
log.Printf("MQTT Client Connected")
if !m.PersistentSession || !m.started {
topics := make(map[string]byte)
for _, topic := range m.Topics {
@ -150,7 +151,7 @@ func (m *MQTTConsumer) onConnect(c mqtt.Client) {
}
func (m *MQTTConsumer) onConnectionLost(c mqtt.Client, err error) {
log.Printf("MQTT Connection lost\nerror: %s\nClient should retry to reconnect", err.Error())
log.Printf("MQTT Connection lost\nerror: %s\nMQTT Client will try to reconnect", err.Error())
return
}