Set tractor loglevel in cli config
parent
4e9057621c
commit
b872696d9f
|
@ -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,14 +61,19 @@ 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 cli as _
|
||||||
from ..brokers import cli as _
|
from ..brokers import cli as _
|
||||||
from ..ui import cli as _
|
from ..ui import cli as _
|
||||||
from ..watchlists import cli as _
|
from ..watchlists import cli as _
|
||||||
|
|
Loading…
Reference in New Issue