Skip to content

Conversation

@mikasenghaas
Copy link
Member

@mikasenghaas mikasenghaas commented Jan 14, 2026

Description

This PR introduces a small QoL logging improvement vf.log_level which is a context manager to temporarily change the log level

>>> import verifiers as vf
>>> import logging
>>> logging.getLogger("verifiers").info("Hi")
2026-01-14 12:21:25 - verifiers - INFO - Hi
>>> with vf.log_level("ERROR"):
...     logging.getLogger("verifiers").info("Hi")
>>>

Note that the second info log does not show. Additionally:

  • removes the redundant setup_logging function in the package init because it already exists in logging_utils (just need the clear handlers call, so that it can be called multiple times without stacking handlers)
  • adds some basic unit tests for the intended behavior

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes


Note

Introduces temporary logging controls and consolidates logging setup.

  • Adds vf.log_level(level: str | int) and vf.quiet_verifiers() context managers in utils/logging_utils.py to adjust/silence verifiers logger within a with block
  • Moves and standardizes setup_logging in utils/logging_utils.py (clears existing handlers to avoid duplicates) and removes redundant init implementation
  • Exposes setup_logging, log_level, and quiet_verifiers via verifiers/__init__.py and initializes with VF_LOG_LEVEL
  • Updates docs/reference.md with new logging utilities and examples
  • Adds tests/test_logging.py covering level setting, handler non-duplication, context behavior, and exception safety

Written by Cursor Bugbot for commit 1b36d7b. This will update automatically on new commits. Configure here.

@mikasenghaas mikasenghaas requested a review from willccbb January 14, 2026 12:24
@mikasenghaas mikasenghaas marked this pull request as ready for review January 14, 2026 12:24
…xt managers

Co-authored-by: williambrown97 <williambrown97@gmail.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ mikasenghaas
❌ cursoragent
You have signed the CLA already but the status is still pending? Let us recheck it.

@willccbb willccbb merged commit 14de20c into main Jan 15, 2026
6 checks passed
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.

5 participants