From 1a898c423af2fe83280343f87fe9a5b4f2653801 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 13 Jun 2019 18:17:52 +0800 Subject: [PATCH] aqctl_corelog: filter log messages. Closes #1316 --- RELEASE_NOTES.rst | 3 +++ artiq/frontend/aqctl_corelog.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index f470b63d6..56cba97ab 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -26,6 +26,9 @@ ARTIQ-5 has changed. * Experiments can now programatically set their default pipeline, priority, and flush flag. * 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 diff --git a/artiq/frontend/aqctl_corelog.py b/artiq/frontend/aqctl_corelog.py index c93908de8..a59998160 100755 --- a/artiq/frontend/aqctl_corelog.py +++ b/artiq/frontend/aqctl_corelog.py @@ -6,7 +6,7 @@ import struct import logging import re -from artiq.tools import * +from artiq import tools from artiq.protocols.pc_rpc import Server from artiq.protocols.logging import log_with_name from artiq.coredevice.comm_mgmt import Request, Reply @@ -15,7 +15,8 @@ from artiq.coredevice.comm_mgmt import Request, Reply def get_argparser(): parser = argparse.ArgumentParser( 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", help="Simulation - does not connect to device") parser.add_argument("core_addr", metavar="CORE_ADDR", @@ -64,6 +65,7 @@ async def get_logs(host): def main(): args = get_argparser().parse_args() + tools.init_logger(args) loop = asyncio.get_event_loop() try: @@ -71,9 +73,8 @@ def main(): get_logs_sim(args.core_addr) if args.simulation else get_logs(args.core_addr)) try: 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: - multiline_log_config(logging.TRACE) loop.run_until_complete(server.wait_terminate()) finally: loop.run_until_complete(server.stop())