rename loglevel --> verbosity, because it's not logging level
This commit is contained in:
parent
f89b2a18e0
commit
84d3868994
@ -31,7 +31,7 @@ class Arg:
|
|||||||
# List of available command line options
|
# List of available command line options
|
||||||
AVAILABLE_CLI_OPTIONS = {
|
AVAILABLE_CLI_OPTIONS = {
|
||||||
# Common options
|
# Common options
|
||||||
"loglevel": Arg(
|
"verbosity": Arg(
|
||||||
'-v', '--verbose',
|
'-v', '--verbose',
|
||||||
help='Verbose mode (-vv for more, -vvv to get all messages).',
|
help='Verbose mode (-vv for more, -vvv to get all messages).',
|
||||||
action='count',
|
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"]
|
ARGS_STRATEGY = ["strategy", "strategy_path"]
|
||||||
|
|
||||||
|
@ -123,11 +123,11 @@ class Configuration(object):
|
|||||||
def _load_logging_config(self, config: Dict[str, Any]) -> None:
|
def _load_logging_config(self, config: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
Extract information for sys.argv and load logging configuration:
|
Extract information for sys.argv and load logging configuration:
|
||||||
the --loglevel, --logfile options
|
the -v/--verbose, --logfile options
|
||||||
"""
|
"""
|
||||||
# Log level
|
# Log level
|
||||||
if 'loglevel' in self.args and self.args.loglevel:
|
if 'verbosity' in self.args and self.args.verbosity:
|
||||||
config.update({'verbosity': self.args.loglevel})
|
config.update({'verbosity': self.args.verbosity})
|
||||||
else:
|
else:
|
||||||
config.update({'verbosity': 0})
|
config.update({'verbosity': 0})
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ def _set_loggers(verbosity: int = 0) -> None:
|
|||||||
|
|
||||||
def setup_logging(config: Dict[str, Any]) -> None:
|
def setup_logging(config: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
Process --loglevel, --logfile options
|
Process -v/--verbose, --logfile options
|
||||||
"""
|
"""
|
||||||
# Log level
|
# Log level
|
||||||
verbosity = config['verbosity']
|
verbosity = config['verbosity']
|
||||||
|
@ -227,7 +227,7 @@ def default_conf():
|
|||||||
},
|
},
|
||||||
"initial_state": "running",
|
"initial_state": "running",
|
||||||
"db_url": "sqlite://",
|
"db_url": "sqlite://",
|
||||||
"loglevel": 3,
|
"verbosity": 3,
|
||||||
}
|
}
|
||||||
return configuration
|
return configuration
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ def test_parse_args_defaults() -> None:
|
|||||||
assert args.config == ['config.json']
|
assert args.config == ['config.json']
|
||||||
assert args.strategy_path is None
|
assert args.strategy_path is None
|
||||||
assert args.datadir is None
|
assert args.datadir is None
|
||||||
assert args.loglevel == 0
|
assert args.verbosity == 0
|
||||||
|
|
||||||
|
|
||||||
def test_parse_args_config() -> None:
|
def test_parse_args_config() -> None:
|
||||||
@ -42,10 +42,10 @@ def test_parse_args_db_url() -> None:
|
|||||||
|
|
||||||
def test_parse_args_verbose() -> None:
|
def test_parse_args_verbose() -> None:
|
||||||
args = Arguments(['-v'], '').get_parsed_arg()
|
args = Arguments(['-v'], '').get_parsed_arg()
|
||||||
assert args.loglevel == 1
|
assert args.verbosity == 1
|
||||||
|
|
||||||
args = Arguments(['--verbose'], '').get_parsed_arg()
|
args = Arguments(['--verbose'], '').get_parsed_arg()
|
||||||
assert args.loglevel == 1
|
assert args.verbosity == 1
|
||||||
|
|
||||||
|
|
||||||
def test_common_scripts_options() -> None:
|
def test_common_scripts_options() -> None:
|
||||||
@ -146,7 +146,7 @@ def test_parse_args_backtesting_custom() -> None:
|
|||||||
call_args = Arguments(args, '').get_parsed_arg()
|
call_args = Arguments(args, '').get_parsed_arg()
|
||||||
assert call_args.config == ['test_conf.json']
|
assert call_args.config == ['test_conf.json']
|
||||||
assert call_args.live is True
|
assert call_args.live is True
|
||||||
assert call_args.loglevel == 0
|
assert call_args.verbosity == 0
|
||||||
assert call_args.subparser == 'backtesting'
|
assert call_args.subparser == 'backtesting'
|
||||||
assert call_args.func is not None
|
assert call_args.func is not None
|
||||||
assert call_args.ticker_interval == '1m'
|
assert call_args.ticker_interval == '1m'
|
||||||
@ -165,7 +165,7 @@ def test_parse_args_hyperopt_custom() -> None:
|
|||||||
call_args = Arguments(args, '').get_parsed_arg()
|
call_args = Arguments(args, '').get_parsed_arg()
|
||||||
assert call_args.config == ['test_conf.json']
|
assert call_args.config == ['test_conf.json']
|
||||||
assert call_args.epochs == 20
|
assert call_args.epochs == 20
|
||||||
assert call_args.loglevel == 0
|
assert call_args.verbosity == 0
|
||||||
assert call_args.subparser == 'hyperopt'
|
assert call_args.subparser == 'hyperopt'
|
||||||
assert call_args.spaces == ['buy']
|
assert call_args.spaces == ['buy']
|
||||||
assert call_args.func is not None
|
assert call_args.func is not None
|
||||||
|
@ -27,7 +27,7 @@ def test_parse_args_backtesting(mocker) -> None:
|
|||||||
call_args = backtesting_mock.call_args[0][0]
|
call_args = backtesting_mock.call_args[0][0]
|
||||||
assert call_args.config == ['config.json']
|
assert call_args.config == ['config.json']
|
||||||
assert call_args.live is False
|
assert call_args.live is False
|
||||||
assert call_args.loglevel == 0
|
assert call_args.verbosity == 0
|
||||||
assert call_args.subparser == 'backtesting'
|
assert call_args.subparser == 'backtesting'
|
||||||
assert call_args.func is not None
|
assert call_args.func is not None
|
||||||
assert call_args.ticker_interval is 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
|
assert hyperopt_mock.call_count == 1
|
||||||
call_args = hyperopt_mock.call_args[0][0]
|
call_args = hyperopt_mock.call_args[0][0]
|
||||||
assert call_args.config == ['config.json']
|
assert call_args.config == ['config.json']
|
||||||
assert call_args.loglevel == 0
|
assert call_args.verbosity == 0
|
||||||
assert call_args.subparser == 'hyperopt'
|
assert call_args.subparser == 'hyperopt'
|
||||||
assert call_args.func is not None
|
assert call_args.func is not None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user