diff --git a/weboob/tools/config/iniconfig.py b/weboob/tools/config/iniconfig.py index 9765dac9070e178787ada498ae40b6dfcf1b69ef..54fef239e25a8241c026915092c689e8923072dd 100644 --- a/weboob/tools/config/iniconfig.py +++ b/weboob/tools/config/iniconfig.py @@ -25,7 +25,6 @@ from collections import OrderedDict from decimal import Decimal -import logging import os import io import sys @@ -33,6 +32,7 @@ from weboob.tools.compat import basestring, unicode from .iconfig import IConfig +from .util import LOGGER __all__ = ['INIConfig'] @@ -50,7 +50,7 @@ def load(self, default={}): self.values = OrderedDict(default) if os.path.exists(self.path): - logging.debug(u'Loading application configuration file: %s.' % self.path) + LOGGER.debug(u'Loading application configuration file: %s.' % self.path) if sys.version_info.major < 3: self.config.readfp(io.open(self.path, "r", encoding='utf-8')) else: @@ -66,14 +66,14 @@ def load(self, default={}): first = True for key, value in self.config.items(DEFAULTSECT): if first: - logging.warning('The configuration file "%s" uses an old-style' % self.path) - logging.warning('Please rename the %s section to %s' % (DEFAULTSECT, self.ROOTSECT)) + LOGGER.warning('The configuration file "%s" uses an old-style' % self.path) + LOGGER.warning('Please rename the %s section to %s' % (DEFAULTSECT, self.ROOTSECT)) first = False self.set(key, value) - logging.debug(u'Application configuration file loaded: %s.' % self.path) + LOGGER.debug(u'Application configuration file loaded: %s.' % self.path) else: self.save() - logging.debug(u'Application configuration file created with default values: %s. ' + LOGGER.debug(u'Application configuration file created with default values: %s. ' 'Please customize it.' % self.path) return self.values diff --git a/weboob/tools/config/util.py b/weboob/tools/config/util.py index 32bf1e93cdc0fbe4575fe60274f767305f7d63c2..a01a9f116d6285631af0ae7bd9e3b2b42fe94c1f 100644 --- a/weboob/tools/config/util.py +++ b/weboob/tools/config/util.py @@ -20,8 +20,12 @@ import os from datetime import datetime +from weboob.tools.log import getLogger -__all__ = ['replace', 'time_buffer'] +__all__ = ['LOGGER', 'replace', 'time_buffer'] + + +LOGGER = getLogger('weboob.config') try: diff --git a/weboob/tools/config/yamlconfig.py b/weboob/tools/config/yamlconfig.py index 59c3aed4e59b5ba5ed39497bb6924469f706e744..55f8953b7f6cddee4af185b6759a9eb37745f15c 100644 --- a/weboob/tools/config/yamlconfig.py +++ b/weboob/tools/config/yamlconfig.py @@ -18,7 +18,6 @@ # along with weboob. If not, see . -import logging import os import tempfile import sys @@ -27,7 +26,7 @@ import yaml from .iconfig import ConfigError, IConfig -from .util import replace +from .util import LOGGER, replace try: from yaml import CLoader as Loader @@ -67,14 +66,14 @@ def __init__(self, path): def load(self, default={}): self.values = default.copy() - logging.debug(u'Loading application configuration file: %s.' % self.path) + LOGGER.debug(u'Loading application configuration file: %s.' % self.path) try: with open(self.path, 'r') as f: self.values = yaml.load(f, Loader=self.LOADER) - logging.debug(u'Application configuration file loaded: %s.' % self.path) + LOGGER.debug(u'Application configuration file loaded: %s.' % self.path) except IOError: self.save() - logging.debug(u'Application configuration file created with default values: %s. Please customize it.' % self.path) + LOGGER.debug(u'Application configuration file created with default values: %s. Please customize it.' % self.path) if self.values is None: self.values = {}