By default save tobiko.log file to the same folder of tobiko.conf file

Change-Id: I914b660658b5680444524f6bf10853849484a58f
This commit is contained in:
Federico Ressi 2019-12-03 16:29:25 +01:00
parent 88cdecbc4f
commit c1cccce756
1 changed files with 8 additions and 0 deletions

View File

@ -159,6 +159,14 @@ def init_tobiko_config(default_config_dirs=None, default_config_files=None,
default_config_files=default_config_files)
CONF.set_source('tobiko', conf)
# expand and normalize log_file and log_dir names
log_file = conf.log_file or 'tobiko.log'
log_dir = conf.log_dir or conf.find_file('.')
log_path = os.path.realpath(os.path.expanduser(
os.path.join(log_dir, log_file)))
conf.log_dir = os.path.dirname(log_path)
conf.log_file = os.path.basename(log_path)
# setup final configuration
log.setup(conf=conf, product_name=product_name, version=version)
setup_tobiko_config(conf=conf)