You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhances logging with better ergonomics and performance (#91)
Enhances logging system with improved ergonomics and debugging
- Adds atom-based log adapter configuration (:elixir, :internal, :test, :silent)
- Adds metadata_fields/0 function to LogManager for centralized field definitions
- Adds environment-aware logging defaults (trace in dev, debug in test, info in prod)
- Adds enhanced debugging logs throughout transition resolution and action execution
- Adds comprehensive trace logging for transition evaluation, condition checking, and state changes
- Adds better error context logging for failed conditions and expression evaluations
- Fixes ElixirLoggerAdapter to support :trace level by mapping to :debug
- Fixes TransitionResolver to return state chart tuples for proper logging threading
- Fixes credo issues by extracting helper functions to reduce complexity and nesting
- Adds config/config.exs for environment-specific Logger configuration
- Updates CLAUDE.md with comprehensive debugging configuration examples
Converts logging functions to performance-optimized macros
- Converts all LogManager level functions (trace, debug, info, warn, error) to macros
- Adds lazy evaluation for optimal performance - arguments only evaluated when logging is enabled
- Adds zero overhead when logging is disabled through early bailout
- Maintains familiar LogManager.level/3 API while providing significant performance benefits
- Adds bind_quoted macro implementation for proper variable scoping
- Adds require LogManager statements to all consuming modules for macro usage
- Removes manual LogManager.enabled? checks since macros handle this automatically
- Removes @SPEC declarations from macro functions to fix dialyzer warnings
- Updates CLAUDE.md with performance optimization documentation and examples
- Maintains all existing functionality while providing hot path performance improvements
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
-`:elixir` - Uses ElixirLoggerAdapter (integrates with Elixir's Logger system)
557
+
-`:internal` - Uses TestAdapter for internal debugging
558
+
-`:test` - Uses TestAdapter (alias for test environments)
559
+
-`:silent` - Uses TestAdapter with no log storage (disables logging)
560
+
561
+
### Log Levels
562
+
563
+
-`:trace` - Very detailed execution tracing (transitions, conditions, actions)
564
+
-`:debug` - General debugging information (state changes, events)
565
+
-`:info` - High-level execution flow
566
+
-`:warn` - Unusual conditions
567
+
-`:error` - Execution errors
568
+
569
+
### Performance-Optimized Logging
570
+
571
+
All LogManager logging functions (`trace/3`, `debug/3`, `info/3`, `warn/3`, `error/3`) are implemented as macros that provide lazy evaluation for optimal performance:
572
+
573
+
```elixir
574
+
# Expensive computations are only performed if logging level is enabled
0 commit comments