forked from M-Labs/artiq
1
0
Fork 0

aqctl_corelog: filter log messages. Closes #1316

This commit is contained in:
Sebastien Bourdeauducq 2019-06-13 18:17:52 +08:00
parent 836dc9b927
commit 1a898c423a
2 changed files with 8 additions and 4 deletions

View File

@ -26,6 +26,9 @@ ARTIQ-5
has changed. has changed.
* Experiments can now programatically set their default pipeline, priority, and flush flag. * Experiments can now programatically set their default pipeline, priority, and flush flag.
* Controllers for third-party devices are now out-of-tree. * Controllers for third-party devices are now out-of-tree.
* ``aqctl_corelog`` now filters log messages below the ``WARNING`` level by default.
This behavior can be changed using the ``-v`` and ``-q`` options like the other
programs.
ARTIQ-4 ARTIQ-4

View File

@ -6,7 +6,7 @@ import struct
import logging import logging
import re import re
from artiq.tools import * from artiq import tools
from artiq.protocols.pc_rpc import Server from artiq.protocols.pc_rpc import Server
from artiq.protocols.logging import log_with_name from artiq.protocols.logging import log_with_name
from artiq.coredevice.comm_mgmt import Request, Reply from artiq.coredevice.comm_mgmt import Request, Reply
@ -15,7 +15,8 @@ from artiq.coredevice.comm_mgmt import Request, Reply
def get_argparser(): def get_argparser():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="ARTIQ controller for core device logs") description="ARTIQ controller for core device logs")
simple_network_args(parser, 1068) tools.add_common_args(parser)
tools.simple_network_args(parser, 1068)
parser.add_argument("--simulation", action="store_true", parser.add_argument("--simulation", action="store_true",
help="Simulation - does not connect to device") help="Simulation - does not connect to device")
parser.add_argument("core_addr", metavar="CORE_ADDR", parser.add_argument("core_addr", metavar="CORE_ADDR",
@ -64,6 +65,7 @@ async def get_logs(host):
def main(): def main():
args = get_argparser().parse_args() args = get_argparser().parse_args()
tools.init_logger(args)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
try: try:
@ -71,9 +73,8 @@ def main():
get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr)) get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr))
try: try:
server = Server({"corelog": PingTarget()}, None, True) server = Server({"corelog": PingTarget()}, None, True)
loop.run_until_complete(server.start(bind_address_from_args(args), args.port)) loop.run_until_complete(server.start(tools.bind_address_from_args(args), args.port))
try: try:
multiline_log_config(logging.TRACE)
loop.run_until_complete(server.wait_terminate()) loop.run_until_complete(server.wait_terminate())
finally: finally:
loop.run_until_complete(server.stop()) loop.run_until_complete(server.stop())