forked from M-Labs/artiq
1
0
Fork 0

logging, aqctl_corelog: recognize log level TRACE.

This commit is contained in:
whitequark 2017-08-31 13:12:22 +00:00
parent 4883eea252
commit c9e2a085ec
2 changed files with 13 additions and 7 deletions

View File

@ -38,15 +38,16 @@ async def get_logs(host):
for line in log.decode("utf-8").splitlines():
m = re.match(r"^\[.+?\] (TRACE|DEBUG| INFO| WARN|ERROR)\((.+?)\): (.+)$", line)
if m.group(1) == 'TRACE':
continue
elif m.group(1) == 'DEBUG':
levelname = m.group(1)
if levelname == 'TRACE':
level = logging.TRACE
elif levelname == 'DEBUG':
level = logging.DEBUG
elif m.group(1) == ' INFO':
elif levelname == ' INFO':
level = logging.INFO
elif m.group(1) == ' WARN':
elif levelname == ' WARN':
level = logging.WARN
elif m.group(1) == 'ERROR':
elif levelname == 'ERROR':
level = logging.ERROR
name = 'firmware.' + m.group(2).replace('::', '.')
text = m.group(3)
@ -63,7 +64,7 @@ def main():
server = Server({"corelog": PingTarget()}, None, True)
loop.run_until_complete(server.start(bind_address_from_args(args), args.port))
try:
multiline_log_config(logging.DEBUG)
multiline_log_config(logging.TRACE)
loop.run_until_complete(server.wait_terminate())
finally:
loop.run_until_complete(server.stop())

View File

@ -7,6 +7,10 @@ from artiq.protocols.asyncio_server import AsyncioServer
from artiq.tools import TaskObject, MultilineFormatter
logging.TRACE = 5
logging.addLevelName(logging.TRACE, 'TRACE')
logger = logging.getLogger(__name__)
_fwd_logger = logging.getLogger("fwd")
@ -23,6 +27,7 @@ _name_to_level = {
"WARNING": logging.WARNING,
"INFO": logging.INFO,
"DEBUG": logging.DEBUG,
"TRACE": logging.TRACE,
}