GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — bad logging documentation {}-formatting placeholder · Issue #109451 · python/cpython Closed Labels DescriptionDocumentation%-formatting (It works)import logging logging.basicConfig(filename='example.log', format='%(msecs)03d - %(message)s') logging.warning('foo') example.log: ✅ Now using the the modern {} format syntax, as the documentation says (doesn't work)import logging logging.basicConfig(filename='example.log', format='{msecs:03d} - {message}', style='{') logging.warning('foo') ❌ Exception: --- Logging error --- Traceback (most recent call last): File "...\Python\Python310\lib\logging\__init__.py", line 1100, in emit msg = self.format(record) File "...\Python\Python310\lib\logging\__init__.py", line 943, in format return fmt.format(record) File "...\Python\Python310\lib\logging\__init__.py", line 681, in format s = self.formatMessage(record) File "...\Python\Python310\lib\logging\__init__.py", line 650, in formatMessage return self._style.format(record) File "...\Python\Python310\lib\logging\__init__.py", line 440, in format return self._format(record) File "...\Python\Python310\lib\logging\__init__.py", line 458, in _format return self._fmt.format(**values) ValueError: Unknown format code 'd' for object of type 'float' Call stack: File "...\main.py", line 26, in <module> logging.warning('foo') Message: 'foo' Arguments: () Proposed fixUse import logging logging.basicConfig(filename='example.log', format='{msecs:03.0f} - {message}', style='{') logging.warning('foo') example.log: ✅ Linked PRsActivity
MetadataMetadataAssigneesLabelsProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |