Installation Guide
Complete installation guide for logly-rs.
Table of Contents
Requirements
Minimum Requirements
- Rust: 1.70.0 or later
- Cargo: Latest stable version
- Operating System: Windows, Linux, macOS
Optional Requirements (for GPU support)
- CUDA Toolkit: 11.0 or later
- NVIDIA GPU: Compute Capability 3.5+
- CUDA Driver: Compatible with toolkit version
Basic Installation
Method 1: Add to Cargo.toml (Recommended)
Add logly to your Cargo.toml:
[dependencies]
logly = "0.0.4"
Then run:
cargo build
Method 2: Cargo Add Command
cargo add logly
Method 3: From Git Repository
[dependencies]
logly = { git = "https://github.com/muhammad-fiaz/logly-rs.git", tag = "v0.0.4" }
Feature Flags
Logly supports several feature flags for customization:
Default Features (Enabled Automatically)
[dependencies]
logly = "0.0.4"
# Includes: async, rotation, json, colors, auto-update-check
Minimal Installation (No Default Features)
[dependencies]
logly = { version = "0.0.4", default-features = false }
Custom Feature Selection
[dependencies]
logly = { version = "0.0.4", default-features = false, features = ["async", "colors"] }
Available Features
| Feature | Description | Default |
|---|---|---|
async | Async logging support | ✓ |
rotation | File rotation support | ✓ |
json | JSON format support | ✓ |
colors | ANSI color support | ✓ |
auto-update-check | Version checking | ✓ |
gpu | GPU/CUDA acceleration | ✗ |
GPU Support
Prerequisites
- Install CUDA Toolkit
Linux:
# Ubuntu/Debian
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get install cuda
# Verify installation
nvcc --version
Windows:
- Download CUDA Toolkit from NVIDIA website
- Run installer and follow instructions
- Add CUDA to PATH
macOS:
- CUDA is not officially supported on macOS
- Use CPU-only version
- Verify GPU
nvidia-smi
Install with GPU Support
[dependencies]
logly = { version = "0.0.4", features = ["gpu"] }
Or via command line:
cargo add logly --features gpu
Build with GPU
cargo build --features gpu
Verification
Test Installation
Create src/main.rs:
use logly::prelude::*; fn main() -> Result<(), Box<dyn std::error::Error>> { let logger = Logger::new(); logger.add_sink(SinkConfig::default())?; logger.info("Logly installed successfully!".to_string())?; logger.success("All systems operational!".to_string())?; Ok(()) }
Run:
cargo run
Expected output:
[INFO] Logly installed successfully!
[SUCCESS] All systems operational!
Test GPU Support (if enabled)
use logly::prelude::*; fn main() -> Result<(), Box<dyn std::error::Error>> { let logger = Logger::new(); logger.add_sink(SinkConfig::default())?; logger.enable_gpu()?; println!("{}", logger.gpu_info()); logger.info("GPU logging enabled!".to_string())?; Ok(()) }
Troubleshooting
Common Issues
1. Compilation Errors
Error: failed to resolve: use of undeclared crate or module
Solution:
cargo clean
cargo build
2. GPU Feature Not Working
Error: GPU logging not available
Solution:
- Verify CUDA installation:
nvcc --version - Check GPU:
nvidia-smi - Rebuild with GPU feature:
cargo build --features gpu
3. Version Conflicts
Error: failed to select a version for logly
Solution:
cargo update
cargo build
4. Missing Dependencies
Error: could not find Cargo.toml
Solution:
cargo init
# Then add logly to Cargo.toml
Platform-Specific Issues
Windows
Issue: CUDA not found
Solution:
set PATH=%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin
Linux
Issue: Permission denied for log files
Solution:
sudo chmod 755 logs/
macOS
Issue: GPU feature not available
Solution: Use CPU-only version (GPU not supported on macOS)
Getting Help
If you encounter issues:
- Check Documentation: https://muhammad-fiaz.github.io/logly-rs
- Search Issues: https://github.com/muhammad-fiaz/logly-rs/issues
- Create Issue: https://github.com/muhammad-fiaz/logly-rs/issues/new
- Discord/Community: Check repository for community links
Debug Mode
Enable debug mode to troubleshoot:
#![allow(unused)] fn main() { let mut config = LoggerConfig::default(); config.debug_mode = true; config.debug_log_file = Some(PathBuf::from("logly_debug.log")); logger.configure(config); }
Next Steps
- Read Quick Start Guide
- Explore Examples
- Check Configuration Guide
- Review API Documentation
Version Information
Current version: 0.0.4
Check for updates:
#![allow(unused)] fn main() { if let Ok(Some(msg)) = logger.check_version() { println!("{}", msg); } }
License
MIT License - see LICENSE file for details.