[engine] Add logging for configuration file
For troubleshooting. see #138
This commit is contained in:
parent
0eca3b8de8
commit
5ca9ab796d
2 changed files with 5 additions and 1 deletions
|
@ -53,7 +53,7 @@ $ ./bumblebee-status -l themes
|
||||||
$ ./bumblebee-status -l modules
|
$ ./bumblebee-status -l modules
|
||||||
```
|
```
|
||||||
|
|
||||||
Any parameter you can specify with `-p <name>=<value>`, you can alternatively specify in `~/.bumblebee-status.conf` or `~/.config/bumblebee-status.conf`.
|
Any parameter you can specify with `-p <name>=<value>`, you can alternatively specify in `~/.bumblebee-status.conf` or `~/.config/bumblebee-status.conf`. This parameters act as a **fallback**, so value specified with `-p` have priority.
|
||||||
|
|
||||||
Configuration files have a format like this:
|
Configuration files have a format like this:
|
||||||
```
|
```
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Module(object):
|
||||||
if os.path.exists(cfg):
|
if os.path.exists(cfg):
|
||||||
self._configFile = RawConfigParser()
|
self._configFile = RawConfigParser()
|
||||||
self._configFile.read(cfg)
|
self._configFile.read(cfg)
|
||||||
|
log.debug("reading configuration file {}".format(cfg))
|
||||||
break
|
break
|
||||||
|
|
||||||
if self._configFile is not None and self._configFile.has_section("module-parameters"):
|
if self._configFile is not None and self._configFile.has_section("module-parameters"):
|
||||||
|
@ -77,9 +78,12 @@ class Module(object):
|
||||||
"""Return the config parameter 'name' for this module"""
|
"""Return the config parameter 'name' for this module"""
|
||||||
name = "{}.{}".format(self.name, name)
|
name = "{}.{}".format(self.name, name)
|
||||||
value = self._config["config"].get(name, default)
|
value = self._config["config"].get(name, default)
|
||||||
|
log.debug("command line parameter {}={}".format(name, str(value)))
|
||||||
if value == default:
|
if value == default:
|
||||||
try:
|
try:
|
||||||
|
log.debug("trying to read {} from configuration file".format(name))
|
||||||
value = self._configFile.get("module-parameters", name)
|
value = self._configFile.get("module-parameters", name)
|
||||||
|
log.debug("configuration file {}={}".format(name, str(value)))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in a new issue