We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems like with the latest version of the structlog package, we can no longer pass a UserWarning to logger.warning().
structlog
UserWarning
logger.warning()
Running this would result in the following log 2022-11-22 13:39.48 [warning ] test, as expected.
2022-11-22 13:39.48 [warning ] test
import structlog logger = structlog.get_logger(__name__) logger.warning(UserWarning("test"))
Running the same code will result in the following error.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/user/miniconda3/envs/env_name/lib/python3.9/site-packages/structlog/_log_levels.py", line 156, in meth return self._proxy_to_logger(name, event % args, **kw) TypeError: unsupported operand type(s) for %: 'UserWarning' and 'tuple'
This will replicate the behavior of 22.1, you can wrap the warning in a string, but it would be nice to have this supported as it was.
import structlog logger = structlog.get_logger(__name__) logger.warning(str(UserWarning("test")))
The text was updated successfully, but these errors were encountered:
This should be effectively fixed by #475 but I really wonder why you would do that?
Sorry, something went wrong.
22.3 is on PyPI
No branches or pull requests
Context
It seems like with the latest version of the
structlog
package, we can no longer pass aUserWarning
tologger.warning()
.Behavior in 22.1.0 / Expected
Running this would result in the following log
2022-11-22 13:39.48 [warning ] test
, as expected.Behavior in 22.2.0 / Error
Running the same code will result in the following error.
Workaround
This will replicate the behavior of 22.1, you can wrap the warning in a string, but it would be nice to have this supported as it was.
The text was updated successfully, but these errors were encountered: