From c0796249b3497dd21b7b1f14120f8e9700975b5b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 16 Oct 2015 18:34:37 +0800 Subject: [PATCH] protocols/logging: document, take level numbers for consistency with master publish --- artiq/protocols/logging.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/artiq/protocols/logging.py b/artiq/protocols/logging.py index 42cca1572..6c3fdded3 100644 --- a/artiq/protocols/logging.py +++ b/artiq/protocols/logging.py @@ -38,6 +38,11 @@ _init_string = b"ARTIQ logging\n" class Server(AsyncioServer): + """Remote logging TCP server. + + Takes one log entry per line, in the format: + source:levelno:name:message + """ async def _handle_connection_cr(self, reader, writer): try: line = await reader.readline() @@ -56,10 +61,10 @@ class Server(AsyncioServer): linesplit = line.split(":", 4) if len(linesplit) != 4: return - source, levelname, name, message = linesplit + source, level, name, message = linesplit try: - level = _name_to_level[levelname] - except KeyError: + level = int(level) + except: return log_with_name(name, level, message, extra={"source": source})