rename loglevel --> verbosity, because it's not logging level

This commit is contained in:
hroff-1902 2019-07-07 02:53:13 +03:00
parent f89b2a18e0
commit 84d3868994
6 changed files with 14 additions and 14 deletions

View File

@ -31,7 +31,7 @@ class Arg:
# List of available command line options
AVAILABLE_CLI_OPTIONS = {
# Common options
"loglevel": Arg(
"verbosity": Arg(
'-v', '--verbose',
help='Verbose mode (-vv for more, -vvv to get all messages).',
action='count',
@ -294,7 +294,7 @@ AVAILABLE_CLI_OPTIONS = {
}
ARGS_COMMON = ["loglevel", "logfile", "version", "config", "datadir"]
ARGS_COMMON = ["verbosity", "logfile", "version", "config", "datadir"]
ARGS_STRATEGY = ["strategy", "strategy_path"]

View File

@ -123,11 +123,11 @@ class Configuration(object):
def _load_logging_config(self, config: Dict[str, Any]) -> None:
"""
Extract information for sys.argv and load logging configuration:
the --loglevel, --logfile options
the -v/--verbose, --logfile options
"""
# Log level
if 'loglevel' in self.args and self.args.loglevel:
config.update({'verbosity': self.args.loglevel})
if 'verbosity' in self.args and self.args.verbosity:
config.update({'verbosity': self.args.verbosity})
else:
config.update({'verbosity': 0})

View File

@ -28,7 +28,7 @@ def _set_loggers(verbosity: int = 0) -> None:
def setup_logging(config: Dict[str, Any]) -> None:
"""
Process --loglevel, --logfile options
Process -v/--verbose, --logfile options
"""
# Log level
verbosity = config['verbosity']

View File

@ -227,7 +227,7 @@ def default_conf():
},
"initial_state": "running",
"db_url": "sqlite://",
"loglevel": 3,
"verbosity": 3,
}
return configuration

View File

@ -19,7 +19,7 @@ def test_parse_args_defaults() -> None:
assert args.config == ['config.json']
assert args.strategy_path is None
assert args.datadir is None
assert args.loglevel == 0
assert args.verbosity == 0
def test_parse_args_config() -> None:
@ -42,10 +42,10 @@ def test_parse_args_db_url() -> None:
def test_parse_args_verbose() -> None:
args = Arguments(['-v'], '').get_parsed_arg()
assert args.loglevel == 1
assert args.verbosity == 1
args = Arguments(['--verbose'], '').get_parsed_arg()
assert args.loglevel == 1
assert args.verbosity == 1
def test_common_scripts_options() -> None:
@ -146,7 +146,7 @@ def test_parse_args_backtesting_custom() -> None:
call_args = Arguments(args, '').get_parsed_arg()
assert call_args.config == ['test_conf.json']
assert call_args.live is True
assert call_args.loglevel == 0
assert call_args.verbosity == 0
assert call_args.subparser == 'backtesting'
assert call_args.func is not None
assert call_args.ticker_interval == '1m'
@ -165,7 +165,7 @@ def test_parse_args_hyperopt_custom() -> None:
call_args = Arguments(args, '').get_parsed_arg()
assert call_args.config == ['test_conf.json']
assert call_args.epochs == 20
assert call_args.loglevel == 0
assert call_args.verbosity == 0
assert call_args.subparser == 'hyperopt'
assert call_args.spaces == ['buy']
assert call_args.func is not None

View File

@ -27,7 +27,7 @@ def test_parse_args_backtesting(mocker) -> None:
call_args = backtesting_mock.call_args[0][0]
assert call_args.config == ['config.json']
assert call_args.live is False
assert call_args.loglevel == 0
assert call_args.verbosity == 0
assert call_args.subparser == 'backtesting'
assert call_args.func is not None
assert call_args.ticker_interval is None
@ -41,7 +41,7 @@ def test_main_start_hyperopt(mocker) -> None:
assert hyperopt_mock.call_count == 1
call_args = hyperopt_mock.call_args[0][0]
assert call_args.config == ['config.json']
assert call_args.loglevel == 0
assert call_args.verbosity == 0
assert call_args.subparser == 'hyperopt'
assert call_args.func is not None