From dc919fa67658e1f8a6ed09eee3f7f558d01955cc Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 1 Aug 2020 22:23:19 -0400 Subject: [PATCH] Set tractor loglevel in cli config --- piker/cli/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/piker/cli/__init__.py b/piker/cli/__init__.py index 097f9ad5..03dd87ae 100644 --- a/piker/cli/__init__.py +++ b/piker/cli/__init__.py @@ -48,9 +48,10 @@ def pikerd(loglevel, host, tl): @click.option('--broker', '-b', default=DEFAULT_BROKER, help='Broker backend to use') @click.option('--loglevel', '-l', default='warning', help='Logging level') +@click.option('--tl', is_flag=True, help='Enable tractor logging') @click.option('--configdir', '-c', help='Configuration directory') @click.pass_context -def cli(ctx, broker, loglevel, configdir): +def cli(ctx, broker, loglevel, tl, configdir): if configdir is not None: assert os.path.isdir(configdir), f"`{configdir}` is not a valid path" config._override_config_dir(configdir) @@ -60,11 +61,16 @@ def cli(ctx, broker, loglevel, configdir): 'broker': broker, 'brokermod': get_brokermod(broker), 'loglevel': loglevel, + 'tractorloglevel': None, 'log': get_console_log(loglevel), 'confdir': _config_dir, 'wl_path': _watchlists_data_path, }) + # allow enabling same loglevel in ``tractor`` machinery + if tl: + ctx.obj.update({'tractorloglevel': loglevel}) + def _load_clis() -> None: from ..data import marketstore as _