Skip to content
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

percentage signs can't be logged in structlog==22.2.0 #479

Closed
danielx opened this issue Nov 23, 2022 · 5 comments
Closed

percentage signs can't be logged in structlog==22.2.0 #479

danielx opened this issue Nov 23, 2022 · 5 comments

Comments

@danielx
Copy link

danielx commented Nov 23, 2022

Hello, it seems the new 22.2.0 release breaks structlog if events/messages contains the % character.

$ pip freeze | grep structlog
structlog==22.2.0

# main.py
import structlog

log = structlog.get_logger()

log.info("example.com/?q=Hello%2C%20World%21")
$ python main.py
Traceback (most recent call last):
  File "/home/daniel/work/structerr/main.py", line 5, in <module>
    log.info("example.com/?q=Hello%2C%20World%21")
  File "/home/daniel/.local/share/virtualenvs/structerr-1KsXSVL2/lib/python3.10/site-packages/structlog/_log_levels.py", line 156, in meth
    return self._proxy_to_logger(name, event % args, **kw)
TypeError: not enough arguments for format string

# main.py
import structlog

log = structlog.get_logger()

log.info("50%")
$ python main.py
Traceback (most recent call last):
  File "/home/daniel/work/structerr/main.py", line 6, in <module>
    log.info("50%")
  File "/home/daniel/.local/share/virtualenvs/structerr-1KsXSVL2/lib/python3.10/site-packages/structlog/_log_levels.py", line 156, in meth
    return self._proxy_to_logger(name, event % args, **kw)
ValueError: incomplete format
@danielx
Copy link
Author

danielx commented Nov 23, 2022

It looks like this issue will also be fixed by #475

@danielx danielx closed this as completed Nov 23, 2022
@hynek
Copy link
Owner

hynek commented Nov 23, 2022

Great, thanks for finding it and sorry!

hynek added a commit that referenced this issue Nov 23, 2022
@hynek
Copy link
Owner

hynek commented Nov 23, 2022

JFTR I've added fc60f2f to ensure it keeps working.

@danielx
Copy link
Author

danielx commented Nov 23, 2022

No problem, thanks for building structlog!

@hynek
Copy link
Owner

hynek commented Nov 24, 2022

22.3 is on PyPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants