From 0064fa979cbdf300d8a5dd4a82e15f7eb819d0ca Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 27 Oct 2023 13:42:42 +0200 Subject: [PATCH] config: fix python 3.9 compatibility --- mylib/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mylib/config.py b/mylib/config.py index 94c3293..f2acf42 100644 --- a/mylib/config.py +++ b/mylib/config.py @@ -864,7 +864,9 @@ class Config: # pylint: disable=too-many-instance-attributes comment=( "File log level limit : by default, all logged messages (according to main log " "level) will be logged to the log file, but you can set a minimal level if you " - f"want. Possible values: {', '.join(logging.getLevelNamesMapping())}." + # logging.getLevelNamesMapping() not available in python 3.9 + # pylint: disable=protected-access + f"want. Possible values: {', '.join(logging._nameToLevel)}." ), ) @@ -968,7 +970,9 @@ class Config: # pylint: disable=too-many-instance-attributes if self.get("logfile", "path"): logfile_handler = logging.FileHandler(self.get("logfile", "path")) logfile_level = ( - logging.getLevelNamesMapping().get(self.get("logfile", "level")) + # logging.getLevelNamesMapping() not available in python 3.9 + # pylint: disable=protected-access + logging._nameToLevel.get(self.get("logfile", "level")) if self.get("logfile", "level") else logging.DEBUG )