in 04_EdgeApplication/turbine/logger.py [0:0]
def __upload_logs__(self):
'''
Invoked by the thread to publish the latest logs
'''
self.__log_lock.acquire(True)
f = json.dumps({'logs': self.logs_buffer})
self.logs_buffer = [] # clean the buffer
try:
self.iot_data_client.publish( topic='wind-turbine/logs/%s' % self.device_name, payload=f.encode('utf-8') )
except Exception as e:
logging.error(e)
self.__update_credentials()
self.iot_data_client.publish( topic='wind-turbine/logs/%s' % self.device_name, payload=f.encode('utf-8') )
logging.info("New log file uploaded. len: %d" % len(f))
self.__log_lock.release()