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

refactor keep processor logic #35

Merged
merged 6 commits into from
Jun 9, 2024
Merged

refactor keep processor logic #35

merged 6 commits into from
Jun 9, 2024

Conversation

wimglenn
Copy link
Owner

@wimglenn wimglenn commented Jun 6, 2024

closes #34

@wimglenn wimglenn merged commit 4aa7642 into main Jun 9, 2024
7 checks passed
@wimglenn wimglenn deleted the keep branch June 9, 2024 19:36
@stianjensen
Copy link

stianjensen commented Jul 24, 2024

After upgrading from 0.9 to version 1.0 (which seems to contain only this PR), i've now gotten very verbose output when running tests (without even running with the verbose flag to pytest), that I didn't use to get before. I don't see this change mentioned in the changelog, or a way to turn it off:

EDIT: I do see now that this is in fact due to running pytest with the -vv flag. However, I do need that since I am also using pytest-clarity, which requires that flag to print pretty diffs on failures.

Is there no other way to still be able to silence this new output from pytest-structlog?

Plugin pytest-structlog is operating in keep mode.
- cmdline-arg: (empty)
- config-file: (empty)
- default-keep-list:
    ExceptionRenderer
    PositionalArgumentsFormatter
    add_log_level
    dict_tracebacks
    merge_contextvars
Structlog processor 'merge_contextvars' is kept due to default-keep-list (<function merge_contextvars at 0x1038a98a0>).
Structlog processor 'filter_by_level' is evicted because no configuration kept it (<function filter_by_level at 0x10447cea0>).
Structlog processor 'TimeStamper' is evicted because no configuration kept it (<structlog.processors.TimeStamper object at 0x10604af80>).
Structlog processor 'add_logger_name' is evicted because no configuration kept it (<function add_logger_name at 0x10447db20>).
Structlog processor 'add_log_level' is kept due to default-keep-list (<function add_log_level at 0x1038ab920>).
Structlog processor 'PositionalArgumentsFormatter' is kept due to default-keep-list (<structlog.stdlib.PositionalArgumentsFormatter object at 0x105ff9610>).
Structlog processor 'StackInfoRenderer' is evicted because no configuration kept it (<structlog.processors.StackInfoRenderer object at 0x105f86800>).
Structlog processor 'CallsiteParameterAdder' is evicted because no configuration kept it (<structlog.processors.CallsiteParameterAdder object at 0x10604afc0>).
Structlog processor 'SentryProcessor' is evicted because no configuration kept it (<structlog_sentry.SentryProcessor object at 0x105d4e5a0>).
Structlog processor 'ExceptionRenderer' is kept due to default-keep-list (<structlog.processors.ExceptionRenderer object at 0x103902750>).
Structlog processor 'UnicodeDecoder' is evicted because no configuration kept it (<structlog.processors.UnicodeDecoder object at 0x1058df860>).
Structlog processor 'ProcessorFormatter.wrap_for_formatter' is evicted because no configuration kept it (<function ProcessorFormatter.wrap_for_formatter at 0x10447e0c0>).

Is this an accidental regression, and/or is there a way to silence this output by default?

@wimglenn
Copy link
Owner Author

wimglenn commented Jul 24, 2024

Intentional. This is not an accidental regression, and it is mentioned in the README (which was part of this PR):

Using pytest -v or pytest -vv you can see more details about which processors pytest-structlog has included or excluded during the test startup.

pytest-structlog 1.0 will report which processors are kept/evicted from configuration, and whether to display that info is keyed off the verbosity level that pytest is running under.

It would be possible to add a configuration option to control this reporting, like auto/always/never.

@wimglenn
Copy link
Owner Author

@stianjensen In 1.1, reporting of pytest-structlog's own settings can also be explicitly enabled/disabled independently of verbosity level by specifying --structlog-settings-report always/never (cmdline) or structlog_settings_report (ini)

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

Successfully merging this pull request may close these issues.

log captures events before processing, not after
2 participants