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

Interpolation raises an error for filtered out logs #476

Closed
maximlt opened this issue Nov 22, 2022 · 3 comments · Fixed by #478
Closed

Interpolation raises an error for filtered out logs #476

maximlt opened this issue Nov 22, 2022 · 3 comments · Fixed by #478
Labels

Comments

@maximlt
Copy link

maximlt commented Nov 22, 2022

Interpolation appears to be broken when the log is filtered out. Observed with structulog 22.2.0.

import logging

import structlog

structlog.configure(
    processors=[
        structlog.contextvars.merge_contextvars,
        structlog.processors.add_log_level,
        structlog.processors.StackInfoRenderer(),
        structlog.dev.set_exc_info,
        structlog.processors.TimeStamper(),
        structlog.dev.ConsoleRenderer()
    ],
    # Note this is set at the INFO level
    wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
    context_class=dict,
    logger_factory=structlog.PrintLoggerFactory(),
    cache_logger_on_first_use=False
)
log = structlog.get_logger()

# Note this is at the DEBUG level, there's no problem at the INFO level or higher
log.debug('hello %s', 'world')

Traceback:

Traceback (most recent call last):
  File "/home/liquetm/dev/python-panels/bug.py", line 21, in <module>
    log.debug('hello %s', 'world')
TypeError: _nop() takes 2 positional arguments but 3 were given
@hynek
Copy link
Owner

hynek commented Nov 23, 2022

Ooof, that's embarrassing! #478 should fix that, right?

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

maximlt commented Nov 23, 2022

That looks right, thanks!!!

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants