def __log(self, msg, level):
payload = {'app_name': str(self.app_name), 'log_level': level, 'message': msg}
try:
self.session.post(url=self.elastic_url, data=json.dumps(payload),
headers=self.headers, auth=self.auth)
except ConnectionError as ce:
logging.error(ce.message)
logging.exception('Unable to connect to Elastic Search. Check the `elastic_url` and `auth`')
logging.error(msg)
评论列表
文章目录