Raxol.Core.Runtime.Log (Raxol v2.0.1)
View SourceCentralized logging system for Raxol with structured context, performance tracking, and consistent formatting across all modules.
Features
- Structured logging with automatic context enrichment
- Module-aware logging with automatic module detection
- Performance and timing utilities
- Standardized error handling with stacktraces
- Debug mode support with conditional logging
- Automatic metadata collection (node, environment, version)
- IO.puts/inspect migration helpers
Usage
Instead of using Logger directly or IO.puts, use this module:
# Basic logging
Log.info("User authenticated successfully")
Log.error("Database connection failed")
# With context
Log.info("Processing request", %{user_id: 123, action: :login})
Log.error("Validation failed", %{errors: errors, input: input})
# Performance timing
Log.time_info("Database query", fn ->
expensive_operation()
end)
# Module-aware logging (automatically detects calling module)
Log.info("Operation completed")
# Migration from IO.puts
Log.console("Debug output for development")
Summary
Functions
Log with automatic error classification and severity detection.
Console logging for development - replacement for IO.puts. Only logs in development/test environments.
Conditional debug logging based on module configuration.
Logs an error with stacktrace and context.
Structured event logging with automatic metadata enrichment.
Structured inspect logging - replacement for IO.inspect.
Module-aware logging that automatically detects the calling module.
Performance timing logger that measures and logs execution time.
Logs a warning with context.
Types
Functions
Log with automatic error classification and severity detection.
Console logging for development - replacement for IO.puts. Only logs in development/test environments.
Conditional debug logging based on module configuration.
Logs an error with stacktrace and context.
Structured event logging with automatic metadata enrichment.
Structured inspect logging - replacement for IO.inspect.
Module-aware logging that automatically detects the calling module.
Performance timing logger that measures and logs execution time.
Logs a warning with context.