feat: Add log level functionality with LogLevel enum and logger methods #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
This PR restores log level functionality similar to the predecessor project (prefab-cloud-js) with a simplified, non-hierarchical approach suitable for client-side evaluation.
Changes
New Features
1. LogLevel Enum
LogLevelenum with values:TRACE,DEBUG,INFO,WARN,ERROR,FATAL2. getLogLevel(loggerName) Method
LogLevelenum value"log-levels.default")LogLevel.DEBUGas default if not configuredloggerNameparameter currently unused (all loggers share same level)3. Logger Convenience Methods
reforge.logger.*API with methods:trace(),debug(),info(),warn(),error(),fatal()reforge.logger.info("message")4. Helper Functions
shouldLogAtLevel(configuredLevel, desiredLevel)- Compare LogLevel enum values (recommended)getLogLevelSeverity(level)- Get numeric severity for manual comparison5. Configuration
loggerKeyinit parameter (default:"log-levels.default")Breaking Changes
shouldLog() No Longer Traverses Hierarchy
log-level.my.app→log-level.my→log-level)log-level.{loggerName})This simplification aligns with the architectural constraint that the server evaluates configs once per request with a single context.
Test Coverage
Documentation
getLogLevel()usage and configurationlogger.*methods with examplesshouldLog()docs to reflect no-hierarchy behaviorExample Usage
Migration Notes
If you were using
shouldLog()with hierarchical logger names, you'll need to:log-level.{loggerName}configsreforge.logger.*methods with the global log levelgetLogLevel()+shouldLogAtLevel()for programmatic checks🤖 Generated with Claude Code