Description
Documentation
In the documentation of the logging LogRecord
it's mentioned that it accepts msg as str argument:
https://docs.python.org/3/library/logging.html#logging.LogRecord
But just below that it explains that in getMessage
:
Returns the message for this LogRecord instance after merging any user-supplied arguments with the message. If the user-supplied message argument to the logging call is not a string, str() is called on it to convert it to a string. This allows use of user-defined classes as messages, whose str method can return the actual format string to be used.
So non-str messages are allowed, and also in LogRecord attributes it's mentioned that non-str messages work and are accepted:
https://docs.python.org/3/library/logging.html#logrecord-attributes
Initially started the discussion in python/typeshed#9914
Linked PRs
Metadata
Metadata
Assignees
Projects
Status