From 0ea39694272141158c1ae492b968f6cd69cabbff Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 25 Feb 2015 21:02:57 +0100 Subject: [PATCH 1/3] config: Debug log ignored sections (fixes: #694) --- mopidy/config/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mopidy/config/__init__.py b/mopidy/config/__init__.py index 885ea3a6..24b4f279 100644 --- a/mopidy/config/__init__.py +++ b/mopidy/config/__init__.py @@ -175,6 +175,7 @@ def _validate(raw_config, schemas): # Get validated config config = {} errors = {} + sections = set(raw_config) for schema in schemas: values = raw_config.get(schema.name, {}) result, error = schema.deserialize(values) @@ -182,6 +183,12 @@ def _validate(raw_config, schemas): errors[schema.name] = error if result: config[schema.name] = result + if schema.name in sections: + sections.remove(schema.name) + + for section in sections: + logger.debug('Ignoring unknown config section: %s', section) + return config, errors From 57012670b71ea73c26177ba13a94ba004d82baaa Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 25 Feb 2015 22:58:46 +0100 Subject: [PATCH 2/3] config: Fixing review comments --- mopidy/config/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mopidy/config/__init__.py b/mopidy/config/__init__.py index 24b4f279..434831e4 100644 --- a/mopidy/config/__init__.py +++ b/mopidy/config/__init__.py @@ -177,14 +177,13 @@ def _validate(raw_config, schemas): errors = {} sections = set(raw_config) for schema in schemas: + sections.discard(schema.name) values = raw_config.get(schema.name, {}) result, error = schema.deserialize(values) if error: errors[schema.name] = error if result: config[schema.name] = result - if schema.name in sections: - sections.remove(schema.name) for section in sections: logger.debug('Ignoring unknown config section: %s', section) From 4a3dfdd415a3c262d170ab97e2da3a7314bd08b1 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 25 Feb 2015 23:28:56 +0100 Subject: [PATCH 3/3] docs: Update changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e1082b09..43d16723 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -48,6 +48,8 @@ v0.20.0 (UNRELEASED) This can be used to show absolutely all log records, including those at custom levels below ``DEBUG``. +- Add debug logging of unknown sections. (Fixes: :issue:`694`) + **Logging** - Add custom log level ``TRACE`` (numerical level 5), which can be used by