Add dynamic log level control with LoggerFilter and LoggerProcessor #15
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
Implements configurable log level management through Reforge configuration, allowing real-time control of logging verbosity without application restarts.
Key Features
reforge-sdk-loggingcontext"log-levels.default") for configuring the config keyLOG_LEVEL_V2config type with context:{"reforge-sdk-logging": {"lang": "python", "logger-path": logger_name}}DEBUGas default when config not foundChanges
Core Implementation
sdk_reforge/log_level.py- LogLevel enum with Python logging level mappingsdk_reforge/logging.py- LoggerFilter and LoggerProcessor implementationssdk_reforge/sdk.py- Addedget_log_level()methodsdk_reforge/options.py- Addedlogger_keyparametersdk_reforge/__init__.py- Export logging classes (removed protobuf LogLevel to avoid conflicts)Dependencies
pyproject.toml- Made structlog optional via extras:pip install sdk-reforge[structlog]Tests
tests/test_log_level.py- Tests for LogLevel enum and get_log_level() methodtests/test_logging.py- Tests for LoggerFilter and LoggerProcessorExamples
examples/standard-logging/- Complete example for standard Python loggingexamples/structlog/- Complete example for structlog integrationUsage
Standard Logging
Structlog
Testing
All tests passing:
test_log_level.pytest_logging.py