comparison roundup/configuration.py @ 5424:fd0481aa17b8

Python 3 preparation: avoid logging._levelNames. logging._levelNames is an internal name, not a public interface, and is not available in current Python 3. Fortunately, logger.setLevel accepts strings for log levels, not just numeric levels, in 2.7 (although that change is not mentioned in the 2.7 documentation).
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 25 Jul 2018 09:31:50 +0000
parents 56c9bcdea47f
children b7fa56ced601
comparison
equal deleted inserted replaced
5423:58057ea53779 5424:fd0481aa17b8
1623 # no logging API to remove all existing handlers!?! 1623 # no logging API to remove all existing handlers!?!
1624 for h in logger.handlers: 1624 for h in logger.handlers:
1625 h.close() 1625 h.close()
1626 logger.removeHandler(hdlr) 1626 logger.removeHandler(hdlr)
1627 logger.handlers = [hdlr] 1627 logger.handlers = [hdlr]
1628 logger.setLevel(logging._levelNames[self["LOGGING_LEVEL"] or "ERROR"]) 1628 logger.setLevel(self["LOGGING_LEVEL"] or "ERROR")
1629 1629
1630 def load(self, home_dir): 1630 def load(self, home_dir):
1631 """Load configuration from path designated by home_dir argument""" 1631 """Load configuration from path designated by home_dir argument"""
1632 if os.path.isfile(os.path.join(home_dir, self.INI_FILE)): 1632 if os.path.isfile(os.path.join(home_dir, self.INI_FILE)):
1633 self.load_ini(home_dir) 1633 self.load_ini(home_dir)

Roundup Issue Tracker: http://roundup-tracker.org/