mirror of https://github.com/m-labs/artiq.git
protocols/logging: document, take level numbers for consistency with master publish
This commit is contained in:
parent
f3e61e265c
commit
c0796249b3
|
@ -38,6 +38,11 @@ _init_string = b"ARTIQ logging\n"
|
||||||
|
|
||||||
|
|
||||||
class Server(AsyncioServer):
|
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):
|
async def _handle_connection_cr(self, reader, writer):
|
||||||
try:
|
try:
|
||||||
line = await reader.readline()
|
line = await reader.readline()
|
||||||
|
@ -56,10 +61,10 @@ class Server(AsyncioServer):
|
||||||
linesplit = line.split(":", 4)
|
linesplit = line.split(":", 4)
|
||||||
if len(linesplit) != 4:
|
if len(linesplit) != 4:
|
||||||
return
|
return
|
||||||
source, levelname, name, message = linesplit
|
source, level, name, message = linesplit
|
||||||
try:
|
try:
|
||||||
level = _name_to_level[levelname]
|
level = int(level)
|
||||||
except KeyError:
|
except:
|
||||||
return
|
return
|
||||||
log_with_name(name, level, message,
|
log_with_name(name, level, message,
|
||||||
extra={"source": source})
|
extra={"source": source})
|
||||||
|
|
Loading…
Reference in New Issue