standardize logging behavior default to log level warn#74
Merged
Conversation
bpapillon
approved these changes
May 20, 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.
Summary
Standardizes how the Python SDK handles logging. The previous default logger emitted at
DEBUG, flooding production consumers with diagnostics they did not opt into. This PR establishes a clean default and adds a configuration option for consumers who want more or less detail.Behavior changes
Important
Default log level is now
WARNING(previouslyDEBUG). If your application relied on the SDK's default logger emittingINFOorDEBUGlines, you'll see fewer log messages after upgrading. Re-enable verbose output withlog_level=logging.DEBUGonSchematicConfig/AsyncSchematicConfig(see below).Three rules now hold for SDK logging:
Default log level is
WARNING.debugandinfocalls from the SDK are suppressed unless the consumer opts in.The default logger's level is configurable via a new top-level config option
log_level(accepts alogginglevel constant or its string name, e.g."DEBUG"):A consumer-provided
loggeris used as-is. If you pass your ownlogging.Loggervia theloggerconfig option, the SDK does not override its level or attach handlers to it. Your logger's existing configuration is the source of truth;log_levelis ignored in that case.Implementation notes
DEFAULT_LOG_LEVELandLogLevelare exported fromschematic.loggingfor consumers who want the type alias.StreamHandleris now tagged with the nameschematichq-default. Repeated calls toget_default_loggerfind and update that handler's level rather than mutating any other handlers a consumer may have attached to a same-named logger out-of-band. No duplicate handlers ever stack.Schematic(sync) andAsyncSchematic(async) clients accept the newlog_leveloption.Test plan
tests/custom/test_logging.py— 16 new tests covering: defaultWARNING, level configurability (int + string forms), handler-level sync, sync/async client wiring, custom-logger-wins behavior, foreign-handler isolation, no duplicate-handler stacking on repeat callspoetry run pytest -n auto— 294 tests passpoetry run mypy src— cleanpoetry run ruff check src/schematic/client.py src/schematic/logging.py tests/custom/test_logging.py— clean (also fixed pre-existing I001 onclient.pywhile we were here)Related
schematic-apiwith the canonical logging contract and a cross-SDK conformance table (other SDKs to follow this pattern).