config: fix python 3.9 compatibility
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b92a814577
commit
0064fa979c
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue