[Python-Dev] Using logging in the stdlib and its unit tests (original) (raw)
Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Dec 8 20:42:00 CET 2010
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<skip pobox.com> writes:
>>> logging.error("error 1 2 3 %s" % "yup") ERROR:root:error 1 2 3 yup >>> logging.error("error 1 2 3 %s", "yup") ERROR:root:error 1 2 3 yup
The second form should be preferred in library code as long as the format string expansion is deferred until after the test is made to emit the message.
Yes, and the string expansion normally is deferred to happen as late as possible.
Regards,
Vinay
- Previous message: [Python-Dev] Using logging in the stdlib and its unit tests
- Next message: [Python-Dev] Using logging in the stdlib and its unit tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]