diff options
author | MichaĆ Klichowicz <emkael@tlen.pl> | 2018-10-17 20:02:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-17 20:02:57 +0200 |
commit | 984540cd2dfba29c1dc9cbc43ab6fa4c85c7727b (patch) | |
tree | d03e49f564cec7c3eec7ce7c98fae530ec1544e0 /jfr_playoff/settings.py | |
parent | 9a5f06ee9cddd38e11f49a2f934de202d34e63e2 (diff) | |
parent | 31fc51ce22e7c5197ed367cadd14d8a258f8fd65 (diff) |
Merge pull request #28 from emkael/develv1.2.0
v1.2
Diffstat (limited to 'jfr_playoff/settings.py')
-rw-r--r-- | jfr_playoff/settings.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py index 021253f..58de66c 100644 --- a/jfr_playoff/settings.py +++ b/jfr_playoff/settings.py @@ -4,6 +4,8 @@ import readline import requests import sys +from jfr_playoff.logger import PlayoffLogger + def complete_filename(text, state): return (glob.glob(text+'*')+[None])[state] @@ -31,9 +33,9 @@ class PlayoffSettings(object): if (key not in base_config) or overwrite: base_config[key] = value except Exception as e: - print 'WARNING: unable to merge remote config: %s' % (str(e)) - if remote_url is not None: - print 'Offending URL: %s' % (remote_url) + PlayoffLogger.get('settings').warning( + 'unable to merge remote config %s: %s(%s)', + remote_url, type(e).__name__, str(e)) return base_config def load(self): @@ -45,16 +47,24 @@ class PlayoffSettings(object): 'JSON settings file: ').decode(sys.stdin.encoding) if self.settings is None: + PlayoffLogger.get('settings').info( + 'loading config file: %s', unicode(self.settings_file)) self.settings = json.loads( open(unicode(self.settings_file)).read().decode('utf-8-sig')) if self.has_section('remotes'): remote_config = {} for remote in self.get('remotes'): + PlayoffLogger.get('settings').info( + 'merging remote config: %s', remote) remote_config = self.__merge_config( remote_config, remote_url=remote) + PlayoffLogger.get('settings').debug( + 'remote config: %s', remote_config) self.settings = self.__merge_config( self.settings, new_config=remote_config, overwrite=False) + PlayoffLogger.get('settings').debug( + 'parsed config: %s', self.settings) def has_section(self, key): self.load() |