diff options
author | Rob Austein <sra@hactrn.net> | 2014-06-05 04:28:06 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2014-06-05 04:28:06 +0000 |
commit | 4b7fec44f0ce55256b3f8f1fde19f2b7ed6fe485 (patch) | |
tree | 04c43527c7b3e7c4d703d727acbe4ae6e02241d3 /rpki/config.py | |
parent | 682e2b1ea221bad77e1dc27325cd1232f07ee407 (diff) |
First cut at fully configurable logging system. Still a bit raw, and
not yet documented, but allows detailed logging configuration down to
the class level, and flexible enough to allow runtime configuration if
we decide we need that.
svn path=/trunk/; revision=5860
Diffstat (limited to 'rpki/config.py')
-rw-r--r-- | rpki/config.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rpki/config.py b/rpki/config.py index ad87239b..f38427c4 100644 --- a/rpki/config.py +++ b/rpki/config.py @@ -120,20 +120,19 @@ class parser(object): """ Parse OpenSSL-style foo.0, foo.1, ... subscripted options. - Returns a list of values matching the specified option name. + Returns iteration of values matching the specified option name. """ matches = [] if section is None: section = self.default_section if self.cfg.has_option(section, option): - matches.append((-1, self.get(option, section = section))) - for key in self.cfg.options(section): - s = key.rsplit(".", 1) - if len(s) == 2 and s[0] == option and s[1].isdigit(): - matches.append((int(s[1]), self.get(option, section = section))) + yield self.cfg.get(section, option) + option += "." + matches = [o for o in self.cfg.options(section) if o.startswith(option) and o[len(option):].isdigit()] matches.sort() - return [match[1] for match in matches] + for option in matches: + yield self.cfg.get(section, option) _regexp = re.compile("\\${(.*?)::(.*?)}") @@ -203,10 +202,12 @@ class parser(object): import rpki.log import rpki.daemonize - try: - rpki.http.debug_http = self.getboolean("debug_http") - except ConfigParser.NoOptionError: - pass + for line in self.multiget("configure_logger"): + try: + name, level = line.split() + logging.getLogger(name).setLevel(getattr(logging, level.upper())) + except Exception, e: + logger.warning("Could not process configure_logger line %r: %s", line, e) try: rpki.http.want_persistent_client = self.getboolean("want_persistent_client") |