[Configuration] Better logging (#545)
* [Config] improve logging * finish
This commit is contained in:
parent
d7dcba4a13
commit
429dace10a
|
@ -289,11 +289,20 @@ class ConfigMixin:
|
||||||
# use value from config dict
|
# use value from config dict
|
||||||
init_dict[key] = config_dict.pop(key)
|
init_dict[key] = config_dict.pop(key)
|
||||||
|
|
||||||
unused_kwargs = config_dict.update(kwargs)
|
config_dict = {k: v for k, v in config_dict.items() if not k.startswith("_")}
|
||||||
|
|
||||||
|
if len(config_dict) > 0:
|
||||||
|
logger.warning(
|
||||||
|
f"The config attributes {config_dict} were passed to {cls.__name__}, "
|
||||||
|
"but are not expected and will be ignored. Please verify your "
|
||||||
|
f"{cls.config_name} configuration file."
|
||||||
|
)
|
||||||
|
|
||||||
|
unused_kwargs = {**config_dict, **kwargs}
|
||||||
|
|
||||||
passed_keys = set(init_dict.keys())
|
passed_keys = set(init_dict.keys())
|
||||||
if len(expected_keys - passed_keys) > 0:
|
if len(expected_keys - passed_keys) > 0:
|
||||||
logger.warning(
|
logger.info(
|
||||||
f"{expected_keys - passed_keys} was not found in config. Values will be initialized to default values."
|
f"{expected_keys - passed_keys} was not found in config. Values will be initialized to default values."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue