Commit a19af187 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Romain Bignon

config: Better logging

Shorter messages and to the point, also show when saved.
parent 67aaee03
Pipeline #2768 failed with stages
in 1 minute and 18 seconds
......@@ -66,14 +66,14 @@ class YamlConfig(IConfig):
def load(self, default={}):
self.values = default.copy()
LOGGER.debug(u'Loading application configuration file: %s.' % self.path)
LOGGER.debug(u'Loading configuration file: %s.' % self.path)
try:
with open(self.path, 'r') as f:
self.values = yaml.load(f, Loader=self.LOADER)
LOGGER.debug(u'Application configuration file loaded: %s.' % self.path)
LOGGER.debug(u'Configuration file loaded: %s.' % self.path)
except IOError:
self.save()
LOGGER.debug(u'Application configuration file created with default values: %s. Please customize it.' % self.path)
LOGGER.debug(u'Configuration file created with default values: %s.' % self.path)
if self.values is None:
self.values = {}
......@@ -87,6 +87,7 @@ class YamlConfig(IConfig):
with f:
yaml.dump(self.values, f, Dumper=self.DUMPER, default_flow_style=False)
replace(f.name, self.path)
LOGGER.debug(u'Configuration file saved: %s.' % self.path)
def get(self, *args, **kwargs):
v = self.values
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment