Skip to content

Conversation

@johnnyt
Copy link
Member

@johnnyt johnnyt commented Sep 1, 2025

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
  • Updates CLAUDE.md with performance optimization documentation and examples
  • Maintains all existing functionality while providing hot path performance improvements

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

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

johnnyt and others added 2 commits September 1, 2025 10:44
- 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

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

Co-Authored-By: Claude <noreply@anthropic.com>
- 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>
@codecov
Copy link

codecov bot commented Sep 1, 2025

Codecov Report

❌ Patch coverage is 86.81319% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/statifier/logging/log_manager.ex 61.11% 7 Missing ⚠️
lib/statifier/actions/action_executor.ex 75.00% 4 Missing ⚠️
lib/statifier/logging/elixir_logger_adapter.ex 75.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
lib/statifier/actions/assign_action.ex 92.85% <ø> (ø)
lib/statifier/actions/foreach_action.ex 94.33% <ø> (+0.10%) ⬆️
lib/statifier/actions/log_action.ex 83.33% <100.00%> (+0.57%) ⬆️
lib/statifier/actions/raise_action.ex 100.00% <ø> (ø)
lib/statifier/actions/send_action.ex 94.73% <ø> (ø)
lib/statifier/datamodel.ex 93.02% <ø> (ø)
lib/statifier/interpreter.ex 91.30% <100.00%> (+0.44%) ⬆️
lib/statifier/interpreter/transition_resolver.ex 100.00% <100.00%> (ø)
lib/statifier/logging/elixir_logger_adapter.ex 80.00% <75.00%> (-3.34%) ⬇️
lib/statifier/actions/action_executor.ex 68.85% <75.00%> (+1.35%) ⬆️
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johnnyt johnnyt changed the title Logging Enhances logging with better ergonomics and performance Sep 1, 2025
@johnnyt johnnyt merged commit 956c5e3 into main Sep 1, 2025
10 checks passed
@johnnyt johnnyt deleted the logging branch September 1, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants