4
我正在尋找一種方法來使用在ini文件中加載到Logging.config.FileConfig時在configparser庫中找到的ExtendedInterpolation功能。與Logging.Config.FileConfig一起使用ExtendedInterpolation
http://docs.python.org/3/library/configparser#configparser.ExtendedInterpolation
所以,如果我有一個ini文件看起來像這樣:
[logSettings]
eventlogs=application
logfilepath=C:\Programs\dk_test\results\dklog_009.log
levelvalue=10
[formatters]
keys=dkeventFmt,dklogFmt
[handlers]
keys=dklogHandler
[handler_dklogHandler]
class=FileHandler
level=${logSettings:levelvalue}
formatter=dklogFmt
args=(${logSettings:logfilepath}, 'w')
[logger_dklog]
level=${logSettings:levelvalue}
handlers=dklogHandler
正如你看到的,我通過使用$ {...}符號來繼擴展插語法在不同部分中引用一個值。當像這樣調用文件logging.config.fileConfig(filepath)
時,模塊內的評估總是失敗。尤其是在部分的參數選項的評估中。
有沒有辦法解決這個問題?謝謝!
注:使用Python 3.2