This concerns pylint and python logging. The following code doesn't work:
logging.basicConfig(level=logging.DEBUG, format='{message}', style='{') log.debug('url {}', url)
It raises:
File "/usr/lib/python3.9/logging/__init__.py", line 363, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting
How do I make the logging work with the {} style instead of %s?
I'm using this basicConfig while testing my modules but I can also have a more advanced formatter in my package. The reason I started exploring this is because pylint was complaining when I used f-strings, but also when I was using old formatting with (%s).
https://stackoverflow.com/questions/66961822/how-to-do-new-style-lazy-formatting-python-logging April 06, 2021 at 10:00AM
没有评论:
发表评论