Repository navigation
Conversation
Provide the logging setup for the Python API and command line tools, without yet using it in the decommutator. The NullHandler keeps messages from being printed through Python's last resort handler when an application has not configured logging. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comments and docstrings assumed familiarity with the logging module. Define terms like logger, level, handler, and propagation for readers who have mainly used print statements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replacing a configuration recorded the level set by the earlier call as the one to restore, so the logger never returned to its original level. Close the earlier configuration instead, which restores the level and removes the need to find handlers by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With no handlers, close could not tell that warnings had been captured and left them captured for the rest of the program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting propagate to False would also stop messages from reaching Dagster's root-level capture and pytest's caplog, so describe the behavior and how to avoid it instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Calling configure_logging inside a step whose logger Dagster manages floods the event log and alters the log file, so describe the recommended setup and the alternative for separate log files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A StreamHandler keeps the stream it was created with, so logging fails with a closed file error after a tool like pytest replaces sys.stderr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover the fixes for restoring the level, capturing warnings without handlers, and following sys.stderr, along with the two Dagster setups described in the documentation. The Dagster tests are skipped when Dagster is not installed, and they ignore warnings because Dagster and its dependencies can issue them on import or during a run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
namurphy
commented
Oct 30, 2026
This matches the call in LoggingConfiguration.close and removes the need to ignore a lint rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comparing against the latest configuration states directly that closing a replaced or closed configuration does nothing, instead of inferring it from which loggers still have the handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the logging infrastructure from #87 on its own, so that it can be reviewed separately from the changes to the decommutator. The decommutator does not use it yet, and its behavior is unchanged.
Changes
NullHandlerto thepyfaradaycuplogger, so that messages aren't printed through Python's last resort handler when an application has not configured logging.pyfaradaycup.configure_logging, which sends messages frompyfaradaycupto the console and/or a log file with UTC timestamps, and can optionally capture warnings. It returns aLoggingConfigurationthat works as a context manager and removes the handlers on close.logging.basicConfig,logging.FileHandler,logging.StreamHandler, andlogging.handlerswith ruff outside of_logging.pyand tests.tests/test_logging.py.Testing
nox -s testspasses on Python 3.9 to 3.14, and pre-commit andnox -s docsalso pass.🤖 Generated with Claude Code