Commit 4d2ad47f authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Includes the first working version of OhmPi messages logging to mqtt and...

Includes the first working version of OhmPi messages logging to mqtt and locally (combined handlers)
Showing with 6 additions and 6 deletions
+6 -6
...@@ -29,8 +29,8 @@ class MQTTHandler(logging.Handler): ...@@ -29,8 +29,8 @@ class MQTTHandler(logging.Handler):
to a MQTT server to a topic. to a MQTT server to a topic.
""" """
def __init__(self, hostname, topic, qos=0, retain=False, def __init__(self, hostname, topic, qos=0, retain=False,
port=1883, client_id='', keepalive=60, will=None, auth=None, port=1883, client_id='', keepalive=60, will=None, auth=None,
tls=None, protocol=MQTTv31, transport='tcp'): tls=None, protocol=MQTTv31, transport='tcp'):
logging.Handler.__init__(self) logging.Handler.__init__(self)
self.topic = topic self.topic = topic
self.qos = qos self.qos = qos
...@@ -52,7 +52,7 @@ class MQTTHandler(logging.Handler): ...@@ -52,7 +52,7 @@ class MQTTHandler(logging.Handler):
""" """
msg = self.format(record) msg = self.format(record)
publish.single(self.topic, msg, self.qos, self.retain, publish.single(self.topic, msg, self.qos, self.retain,
hostname=self.hostname, port=self.port, hostname=self.hostname, port=self.port,
client_id=self.client_id, keepalive=self.keepalive, client_id=self.client_id, keepalive=self.keepalive,
will=self.will, auth=self.auth, tls=self.tls, will=self.will, auth=self.auth, tls=self.tls,
protocol=self.protocol, transport=self.transport) protocol=self.protocol, transport=self.transport)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment