feat: standard library logging for embedding applications#218
Merged
Conversation
stanislaw
reviewed
Jun 10, 2026
Follow the documented stdlib convention for logging in libraries: attach a NullHandler to the "reqif" package logger and log through per-module logging.getLogger(__name__) loggers. Applications that embed reqif can now attach handlers to the "reqif" logger hierarchy to observe library diagnostics; nothing is emitted by default. Convert the one library-code print() (unknown child tag warning in SpecObjectParser.unparse, previously noqa: T201) to logger.warning. The CLI attaches a stdout handler that renders warnings in the exact format print() produced, so CLI output is unchanged. Recoverable schema errors collected during parsing are logged at DEBUG (their canonical reporting channel remains the bundle's exceptions list, which the validate command prints). CLI commands keep using print() for their own user-facing output. A "Logging" section in the README documents how library users opt in.
2f1874f to
08de6eb
Compare
stanislaw
approved these changes
Jun 11, 2026
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.
Follow the documented
stdlibconvention for logging in libraries: attach aNullHandlerto the "reqif" package logger and log through per-modulelogging.getLogger(__name__)loggers. Applications that embedreqifcan now attach handlers to the "reqif" logger hierarchy to observe library diagnostics; nothing is emitted by default.Convert the one library-code
print()(unknown child tag warning inSpecObjectParser.unparse, previously noqa: T201) tologger.warning. The CLI attaches astdouthandler that renders warnings in the exact formatprint()produced, so CLI output is unchanged. Recoverable schema errors collected during parsing are logged at DEBUG (their canonical reporting channel remains the bundle's exceptions list, which the validate command prints). CLI commands keep usingprint()for their own user-facing output.