summaryrefslogtreecommitdiff
path: root/jfr_playoff/settings.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-25 11:17:24 +0100
committeremkael <emkael@tlen.pl>2018-02-25 11:17:24 +0100
commita8aa671f49152dc7975de9bd62b929aab0ff309b (patch)
tree642dca7069a98644e54d526d8255a2ac7364cbff /jfr_playoff/settings.py
parent70a74524095166ee349603e2d48f2cf7c6c5f118 (diff)
parent8c500a75a6eafd65b332d0f8346d9059d5293cbb (diff)
Merge branch 'verbose_logging' into devel
Diffstat (limited to 'jfr_playoff/settings.py')
-rw-r--r--jfr_playoff/settings.py16
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()