Add debug printing

This commit is contained in:
Nico Schottelius 2016-11-14 08:30:11 +01:00
parent d3f73e68f3
commit 355eb681da
2 changed files with 6 additions and 3 deletions

View File

@ -12,8 +12,6 @@ import lorautil
import logging import logging
import sys import sys
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
known_devices = [ "0004A30B001C6613" ] known_devices = [ "0004A30B001C6613" ]
@ -41,6 +39,8 @@ def get_gps(deveui, payload):
text = ":lat={lat:.6f} lon={lon:.6f} alt={alt:.6f} acc={acc:.2f}".format(**values) text = ":lat={lat:.6f} lon={lon:.6f} alt={alt:.6f} acc={acc:.2f}".format(**values)
res = [ deveui + text ] res = [ deveui + text ]
log.debug("ttn mapper: {}".format(res[0]))
return res return res
def decode(pkg): def decode(pkg):
@ -68,6 +68,10 @@ def nodered(provider, data):
lorautil.nodered_send(provider, d) lorautil.nodered_send(provider, d)
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(format='%(levelname)s: %(message)s')
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
conns = lorautil.pg_conn_notify() conns = lorautil.pg_conn_notify()
while True: while True:

View File

@ -20,7 +20,6 @@ log = logging.getLogger(__name__)
dbname="lorawan" dbname="lorawan"
def db_notify(provider, payload='', deveui=''): def db_notify(provider, payload='', deveui=''):
notify="{}:{}".format(deveui, payload) notify="{}:{}".format(deveui, payload)
log.debug("Notify: {} {}".format(provider, notify)) log.debug("Notify: {} {}".format(provider, notify))