Skip to content

feat: add LOG_LEVEL_V2 with getLogLevel() and logger integrations#29

Merged
jkebinger merged 6 commits intomainfrom
loglevel-v2
Nov 4, 2025
Merged

feat: add LOG_LEVEL_V2 with getLogLevel() and logger integrations#29
jkebinger merged 6 commits intomainfrom
loglevel-v2

Conversation

@jkebinger
Copy link
Copy Markdown
Contributor

Summary

Implements dynamic log level control using the new LOG_LEVEL_V2 config type with getLogLevel() method and optional integrations for popular logging frameworks.

Core Features

  • getLogLevel(loggerName): LogLevel - New method to retrieve log levels from LOG_LEVEL_V2 configs
  • ConfigType.LogLevelV2 - New config type for v2 log level system
  • loggerKey option - Defaults to "log-levels.default", specifies which config to evaluate
  • Context-based evaluation - Uses reforge-sdk-logging.logger-path context for targeting
  • No hierarchy traversal - Each logger name evaluated independently (unlike v1)
  • Returns DEBUG as default when config not found

Logger Integrations (Optional Peer Dependencies)

  • Pino integration (pino >=7.0.0)
    • createPinoLogger() - Create logger with dynamic levels
    • createPinoHook() - Mixin for existing loggers
  • Winston integration (winston >=3.0.0)
    • createWinstonLogger() - Create logger with dynamic levels
    • createWinstonFormat() - Format for existing loggers
  • Graceful degradation - Auto-detects availability, console warnings if not installed
  • Auto-skipping tests - Integration tests skip when dependencies not present

Documentation

  • INTEGRATIONS.md - Complete guide with setup, examples, and configuration
  • README.md - Updated with getLogLevel() method and loggerKey option
  • Level mapping tables and usage examples

Testing

  • 11 new tests for getLogLevel() functionality
  • 11 integration tests (auto-skip without pino/winston)
  • All 529 existing tests pass
  • Build succeeds (222 kB)

Breaking Changes

None - All additions are backward compatible

Test plan

  • Core getLogLevel() tests pass (11 tests)
  • Integration tests properly skip when dependencies absent
  • All existing tests pass (529 tests)
  • Build succeeds
  • Documentation complete

🤖 Generated with Claude Code

Implements dynamic log level control using LOG_LEVEL_V2 config type.

Core Features:
- Add getLogLevel(loggerName) method to Reforge and Resolver
- Add ConfigType.LogLevelV2 enum value
- Add loggerKey option (defaults to 'log-levels.default')
- Evaluates log level with context: reforge-sdk-logging.logger-path
- Returns DEBUG as default when config not found
- No hierarchy traversal (unlike v1 implementation)

Logger Integrations (Optional Peer Dependencies):
- Pino integration: createPinoLogger(), createPinoHook()
- Winston integration: createWinstonLogger(), createWinstonFormat()
- Dynamic import with graceful degradation
- Auto-skip integration tests when libs not installed
- Support pino >=7.0.0, winston >=3.0.0

Tests:
- 11 new tests for getLogLevel() functionality
- 11 integration tests (auto-skip without pino/winston)
- All 529 existing tests pass

Documentation:
- INTEGRATIONS.md with complete usage examples
- README.md updated with getLogLevel() and loggerKey option
- Configuration instructions and level mapping tables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
jkebinger and others added 5 commits November 4, 2025 12:31
- Add @types/node to devDependencies to satisfy ts-node peer dependency
- Replace @ts-ignore with @ts-expect-error in pino and winston integrations
- Fixes linter errors and peer dependency warnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Release includes:
- LOG_LEVEL_V2 with getLogLevel() and logger integrations
- Pino and Winston logger integrations
- Bug fixes and dependency updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add prominent link to https://docs.reforge.com/docs/sdks/node at the top of README

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@jdwyah jdwyah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@jkebinger jkebinger merged commit 0d87b2b into main Nov 4, 2025
2 checks passed
@jkebinger jkebinger deleted the loglevel-v2 branch November 4, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants