From 4e50c8291bd83a3fbb24a209fd1f6c7cbdb5283c Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 11 Feb 2013 22:57:05 +0100 Subject: daemon: add some more log entries Signed-off-by: Florian Pritz --- daemon.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index 91b38e8..9d35f33 100755 --- a/daemon.py +++ b/daemon.py @@ -21,6 +21,7 @@ class Daemon: def __init__(self): self.ser = serial.Serial(sys.argv[1], 9600, timeout=1) + logger.debug("connected. waiting for client greeting") # raise timeout to let arduino start up self.ser.timeout = 15 @@ -29,13 +30,14 @@ class Daemon: # arduino sometimes has a dirty buffer # and sends junk before the ready message if not incoming.endswith("ready"): - sys.stderr.write("Got unexpected reply: "+incoming) - raise Exception("Wrong client greeting") + log.error("Got reply: '"+incoming+"'") + raise Exception("Wrong or no client greeting") self.ser.timeout = 1 + logger.debug("got client greeting") self.client = mpd.MPDClient() self.client.connect("localhost", 6600) - logger.debug("connected") + logger.debug("connected to mpd") def readline(self): return self.ser.readline().decode("ascii").strip() -- cgit v1.2.3-24-g4f1b