Skip to content

feat: standard library logging for embedding applications#218

Merged
stanislaw merged 1 commit into
strictdoc-project:mainfrom
fNBU:feat/library-logging
Jun 11, 2026
Merged

feat: standard library logging for embedding applications#218
stanislaw merged 1 commit into
strictdoc-project:mainfrom
fNBU:feat/library-logging

Conversation

@fNBU

@fNBU fNBU commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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.

Comment thread reqif/__init__.py
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.
@fNBU fNBU force-pushed the feat/library-logging branch from 2f1874f to 08de6eb Compare June 11, 2026 19:21
@stanislaw stanislaw merged commit 1cae78e into strictdoc-project:main Jun 11, 2026
9 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.

3 participants