]> kaliko git repositories - mpd-sima.git/blobdiff - sima/utils/config.py
Improved log handling
[mpd-sima.git] / sima / utils / config.py
index e9da8f8f4c245f72b38a27f58f4e97df654c0002..b3a8d46a8c0c9a4d94ed001295226e631eecf61e 100644 (file)
@@ -25,6 +25,7 @@ Parse configuration file and set defaults for missing options.
 
 # IMPORTS
 import configparser
+import logging
 import sys
 
 from configparser import Error
@@ -105,8 +106,8 @@ class ConfMan(object):  # CONFIG MANAGER CLASS
         * command line options (overrides previous)
     """
 
-    def __init__(self, logger, options=None):
-        self.log = logger
+    def __init__(self, options=None):
+        self.log = logging.getLogger('sima')
         # options settings priority:
         # defauts < env. var. < conf. file < command line
         self.conf_file = options.get('conf_file')
@@ -122,20 +123,6 @@ class ConfMan(object):  # CONFIG MANAGER CLASS
         # generate dbfile
         self.config['sima']['db_file'] = join(self.config['sima']['var_dir'], 'sima.db')
 
-    def get_pw(self):
-        try:
-            self.config.getboolean('MPD', 'password')
-            self.log.debug('No password set, proceeding without ' +
-                           'authentication...')
-            return None
-        except ValueError:
-            # ValueError if password not a boolean, hence an actual password.
-            pwd = self.config.get('MPD', 'password')
-            if not pwd:
-                self.log.debug('Password set as an empty string.')
-                return None
-            return pwd
-
     def control_mod(self):
         """
         Controls conf file permissions.