New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twisted.logger doesn't execute methods despite documentation #9347
Comments
Still reproducible with 23.10.0. |
@number492 Thanks for bumping this. |
@number492 if you'd like to code-review the fix in #12040, and CI is happy, we can land it and get this addressed in the next release. |
Sure, I checked it out and it looks good. I'm not a contributor though, and I'm not familiar with the project's conventions. |
Thanks for the quick fix! |
You're welcome. Thanks for the bug report! |
It may come up that people want to log things based on data gotten from object methods, e.g.
where
user.hostmask()
is some sort of useful data.According to the documentation (https://twistedmatrix.com/documents/16.1.1/core/howto/logger.html#format-strings), not only is this allowed, but there is an example showing that this is explicitly allowed.
However, attempting to log the above message results in Twisted logging something like this:
Instead, in order to get the desired logging, you need to modify it so that the functions aren't run on objects in the string:
This logs as expected, but the need to change to this doesn't match up with what the documentation says.
Either object methods need to be allowed, or the documentation needs to be changed to disallow it (including modifying the example where an object method is explicitly used in this way).
Searchable metadata
The text was updated successfully, but these errors were encountered: