3 releases
Uses new Rust 2024
| 0.1.4 | Jul 21, 2025 |
|---|---|
| 0.1.1 | May 7, 2025 |
| 0.1.0 | Oct 4, 2024 |
#229 in Debugging
351 downloads per month
Used in 38 crates
(23 directly)
26KB
249 lines
MoosicBox Logging
Basic logging utilities with feature-gated modules for MoosicBox applications.
Overview
The MoosicBox Logging package provides:
- Feature-Gated Modules: Optional logging implementations
- Free Log Integration: Optional free_log module (requires
free_logfeature) - Logging Macros: Optional logging macro utilities (requires
macrosfeature) - Minimal Core: Lightweight base with optional extensions
Current Implementation
Core Components
- Feature-Gated Architecture: Modular logging components behind feature flags
- Free Log Module: Integration with free_log system (optional)
- Macro Module: Logging macro utilities (optional)
Available Features
free_log: Enables free_log integration modulemacros: Enables logging macro utilities
Installation
Cargo Dependencies
[dependencies]
moosicbox_logging = { path = "../logging" }
# Enable specific features
moosicbox_logging = {
path = "../logging",
features = ["free_log", "macros"]
}
Usage
With Free Log Feature
#[cfg(feature = "free_log")]
use moosicbox_logging::*; // Free log functionality
#[cfg(feature = "free_log")]
async fn setup_logging() -> Result<(), Box<dyn std::error::Error>> {
// Use free_log integration
// (implementation details depend on the free_log module)
Ok(())
}
With Macros Feature
#[cfg(feature = "macros")]
use moosicbox_logging::*; // Logging macros
#[cfg(feature = "macros")]
fn use_logging_macros() {
// Use logging macro utilities
// (implementation details depend on the macros module)
}
Basic Usage
// Basic usage without features
// (minimal functionality available)
#[cfg(all(feature = "free_log", feature = "macros"))]
async fn full_logging_setup() -> Result<(), Box<dyn std::error::Error>> {
// Both free_log and macros available
// Use complete logging functionality
Ok(())
}
Implementation Notes
- The package provides minimal core functionality without features
- Logging capabilities are contained within feature-gated modules
- Free log integration requires the
free_logfeature - Logging macros require the
macrosfeature - Features can be used independently or together
Features
- Default: Minimal core (no logging functionality)
free_log: Enables free_log integration modulemacros: Enables logging macro utilities
Development Status
This package currently provides:
- Modular Architecture: Feature-gated logging components
- Free Log Integration: Optional integration with free_log system
- Macro Support: Optional logging macro utilities
- Minimal Overhead: Include only needed logging features
The actual logging implementations are contained within the feature-gated modules. Enable the appropriate features to access logging functionality.
Usage Patterns
// Feature-gated imports
#[cfg(feature = "free_log")]
use moosicbox_logging::*; // Free log functions
#[cfg(feature = "macros")]
use moosicbox_logging::*; // Logging macros
// Conditional compilation based on features
#[cfg(feature = "free_log")]
fn setup_free_log() {
// Free log setup
}
#[cfg(feature = "macros")]
fn use_macros() {
// Use logging macros
}
This design allows consumers to include only the logging components they need, keeping the package lightweight while providing extensible logging capabilities.
Dependencies
~4–20MB
~219K SLoC