Set tractor loglevel in cli config

bar_select
Tyler Goodlet 2020-08-01 22:23:19 -04:00
parent ec4f7476c5
commit dc919fa676
1 changed files with 7 additions and 1 deletions

View File

@ -48,9 +48,10 @@ def pikerd(loglevel, host, tl):
@click.option('--broker', '-b', default=DEFAULT_BROKER, @click.option('--broker', '-b', default=DEFAULT_BROKER,
help='Broker backend to use') help='Broker backend to use')
@click.option('--loglevel', '-l', default='warning', help='Logging level') @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.option('--configdir', '-c', help='Configuration directory')
@click.pass_context @click.pass_context
def cli(ctx, broker, loglevel, configdir): def cli(ctx, broker, loglevel, tl, configdir):
if configdir is not None: if configdir is not None:
assert os.path.isdir(configdir), f"`{configdir}` is not a valid path" assert os.path.isdir(configdir), f"`{configdir}` is not a valid path"
config._override_config_dir(configdir) config._override_config_dir(configdir)
@ -60,11 +61,16 @@ def cli(ctx, broker, loglevel, configdir):
'broker': broker, 'broker': broker,
'brokermod': get_brokermod(broker), 'brokermod': get_brokermod(broker),
'loglevel': loglevel, 'loglevel': loglevel,
'tractorloglevel': None,
'log': get_console_log(loglevel), 'log': get_console_log(loglevel),
'confdir': _config_dir, 'confdir': _config_dir,
'wl_path': _watchlists_data_path, 'wl_path': _watchlists_data_path,
}) })
# allow enabling same loglevel in ``tractor`` machinery
if tl:
ctx.obj.update({'tractorloglevel': loglevel})
def _load_clis() -> None: def _load_clis() -> None:
from ..data import marketstore as _ from ..data import marketstore as _