aboutsummaryrefslogtreecommitdiff
path: root/voctocore/lib/controlserver.py
diff options
context:
space:
mode:
authorMaZderMind <peter@mazdermind.de>2014-08-24 15:36:26 +0200
committerMaZderMind <peter@mazdermind.de>2014-08-24 15:36:26 +0200
commit90001a38c03e41faeccd0b959753a00db670c61a (patch)
tree5b615386c6033fc40fa05c931ff4a435041f5183 /voctocore/lib/controlserver.py
parente8775c12ff7027675a564cf722c7778ffd060cc9 (diff)
basic quadmix impl
Diffstat (limited to 'voctocore/lib/controlserver.py')
-rw-r--r--voctocore/lib/controlserver.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py
index e11d6a8..fffeda8 100644
--- a/voctocore/lib/controlserver.py
+++ b/voctocore/lib/controlserver.py
@@ -1,4 +1,4 @@
-import socket, threading, queue
+import socket, threading, queue, logging
from gi.repository import GObject
def controlServerEntrypoint(f):
@@ -7,6 +7,7 @@ def controlServerEntrypoint(f):
return f
class ControlServer():
+ log = logging.getLogger('ControlServer')
def __init__(self, videomix):
'''Initialize server and start listening.'''
self.videomix = videomix
@@ -22,7 +23,7 @@ class ControlServer():
def listener(self, sock, *args):
'''Asynchronous connection listener. Starts a handler for each connection.'''
conn, addr = sock.accept()
- print("Connection from ", addr)
+ self.log.info("Connection from %s", addr)
# register data-received handler inside the GTK-Mainloop
GObject.io_add_watch(conn, GObject.IO_IN, self.handler)
@@ -32,7 +33,7 @@ class ControlServer():
'''Asynchronous connection handler. Processes each line from the socket.'''
line = conn.recv(4096)
if not len(line):
- print("Connection closed.")
+ self.log.debug("Connection closed.")
return False
r = self.processLine(line.decode('utf-8'))
@@ -49,7 +50,7 @@ class ControlServer():
def processLine(self, line):
command, argstring = (line.strip()+' ').split(' ', 1)
args = argstring.strip().split()
- print(command, args)
+ self.log.info(command % args)
if not hasattr(self.videomix, command):
return 'unknown command {}'.format(command)