-
Notifications
You must be signed in to change notification settings - Fork 1
Restore log level functionality with LOG_LEVEL_V2 support #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Add Reforge::LogLevel enum for public API (:trace, :debug, :info, :warn, :error, :fatal) - Add Reforge::LogLevelClient with getLogLevel, should_log?, and semantic_filter methods - Add logger_key option to Reforge::Options (defaults to 'log-levels.default') - Implement LOG_LEVEL_V2 config evaluation with "reforge-sdk-logging" context - Add SemanticLogger integration support for dynamic log level filtering - Add comprehensive test coverage (12 tests, 35 assertions) - Update README with SemanticLogger integration documentation - Include protobuf update from previous commit This implementation differs from the predecessor by using a single LOG_LEVEL_V2 config evaluation rather than walking up a tree of logger names, providing a simpler and more explicit approach to log level management. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move semantic_logger from runtime to development dependency - Make semantic_logger optional with graceful fallback - Add stdlib Logger integration via stdlib_formatter method - Update README with stdlib Logger documentation - Improves flexibility for customer integration by removing required dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b574608 to
a3b4472
Compare
- Change InternalLogger to check if SemanticLogger is defined - Fall back to stdlib Logger when SemanticLogger is not available - Preserve all original functionality for SemanticLogger users - Add support for trace, debug, info, warn, error, fatal methods - Update gemspec to include internal_logger.rb Fixes CI test failures where SemanticLogger is not installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add SemanticLogger check in common_helpers setup - Make Reforge.log_filter gracefully handle missing SemanticLogger - Make bootstrap_log_level return true when SemanticLogger unavailable - Add warning message when log_filter used without SemanticLogger Fixes test failures when SemanticLogger is not installed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add level getter method that returns symbol for both SemanticLogger and stdlib Logger - Make stdlib Logger output dynamically check for $logs (test environment) - Ensures logs go to $logs during tests instead of only $stderr - Fixes test failures where assert_logged expects logs in $logs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add custom formatter to stdlib Logger that mimics SemanticLogger format - Remove SemanticLogger check from using_reforge_log_filter! to work with both logger types - Track all InternalLogger instances regardless of logger type - Change log_filter warning from WARN to DEBUG level (optional dependency shouldn't warn) - Formatter outputs "ClassName -- Message" to match test expectations Fixes CI test failures with unexpected log formats and warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add @level_sym instance variable to track exact symbol level (including :trace) - Fix level getter to return tracked symbol for stdlib Logger (preserves :trace vs :debug distinction) - Make using_reforge_log_filter! less aggressive for stdlib Logger (stays at :warn instead of :trace) - Initialize @level_sym properly in create_stdlib_logger - Prevents debug/info log flooding in CI tests where SemanticLogger is not available With SemanticLogger, semantic filter controls output at :trace level. Without SemanticLogger, keeping level at :warn prevents excessive logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Test now checks if SemanticLogger is defined - With SemanticLogger: expects :trace level after using_reforge_log_filter! - Without SemanticLogger: expects :warn level (to prevent log flooding) - Matches the actual behavior of InternalLogger Fixes CI test failure where SemanticLogger is not available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Move semantic_logger from development to test group in Gemfile - stdlib Logger now always writes to $stderr (not $logs) - Tests use $logs for SemanticLogger-filtered output only - Restore using_reforge_log_filter! to always set :trace level - Restore test to always expect :trace after calling using_reforge_log_filter! This allows local testing with SemanticLogger while CI can test without it. stdlib Logger logs go to $stderr and won't appear as unexpected in $logs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Release includes restored log level functionality with support for both SemanticLogger and stdlib Logger. Changes: - Restore log level functionality with LOG_LEVEL_V2 support - Make SemanticLogger optional - SDK now works with or without it - Add stdlib Logger support as alternative to SemanticLogger - Add InternalLogger that automatically uses SemanticLogger or stdlib Logger - Add logger_key initialization option for configuring dynamic log levels - Add stdlib_formatter method for stdlib Logger integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
jdwyah
approved these changes
Oct 31, 2025
Contributor
jdwyah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
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
This PR restores dynamic log level functionality from the predecessor project (prefab-cloud-ruby) with a modernized approach using LOG_LEVEL_V2 config evaluation.
Changes
New Files
lib/reforge/log_level.rb- Public LogLevel enum (:trace, :debug, :info, :warn, :error, :fatal)lib/reforge/log_level_client.rb- Client for managing dynamic log levels with SemanticLogger and stdlib Logger supporttest/test_log_level_client.rb- Comprehensive test coverage (12 tests, 35 assertions)Modified Files
lib/reforge/client.rb- Addedlog_level_clientaccessorlib/reforge/options.rb- Addedlogger_keyoption (defaults to 'log-levels.default')lib/sdk-reforge.rb- Added requires for new log level modules, made semantic_logger optionalGemfile- Moved semantic_logger from runtime to development dependencysdk-reforge.gemspec- Updated dependencies to make semantic_logger optionalREADME.md- Added documentation for both SemanticLogger and stdlib Logger integrationlib/prefab_pb.rb- Protobuf update (from previous commit)Key Features
1. LogLevel Enum
Public API for log levels that abstracts away the protobuf implementation:
2. LogLevelClient Methods
get_log_level(logger_name)- Evaluates LOG_LEVEL_V2 config and returns the appropriate log levelshould_log?(severity, path)- Compares numeric severity against configured levelsemantic_filter(log)- SemanticLogger integration for automatic filtering (optional)stdlib_formatter(logger_name)- Ruby stdlib Logger integration via custom formatter3. Context-Based Evaluation
Log levels are evaluated with the following context:
4. Flexible Logger Integration
SemanticLogger (optional dependency):
Ruby stdlib Logger:
5. Optional Dependencies
semantic_loggeris now a development dependency, not required at runtimeKey Differences from Predecessor
Unlike the predecessor implementation that walked up a tree of logger names (e.g.,
log-level.my_app,log-level.my_app.my_class), this implementation:Testing
All tests pass:
Test coverage includes:
Configuration
In Reforge Launch, create a
LOG_LEVEL_V2config that can use criteria on thereforge-sdk-logging.logger-pathproperty to set different log levels for different classes/modules.🤖 Generated with Claude Code