🦋 ChrysalisRS
Transform your logs into beautiful, structured JSON for elegant display in web UIs.
Getting Started • Features • Examples • Extending • Web UI Integration • Contributing
✨ Overview
ChrysalisRS transforms your application logs into rich, structured data ready for modern web interfaces. Like its namesake, it represents the beautiful metamorphosis of raw log data into elegant, interactive visualizations.
use ;
let mut log = new;
log.add_context;
log.add_context;
// Serialize to JSON with one line
let json = log.to_json?;
// Ready for your web UI!
🚀 Getting Started
Add ChrysalisRS to your Cargo.toml:
[]
= "0.1.0"
Quick Example
use ;
✨ Features
Core Features
- 100% Extensible Architecture: Design your own log structures with full serialization support
- Zero Dependencies for Core Functions: Minimal overhead, maximum performance
- Type-Safe Logging: Leverage Rust's type system for reliable logging
- Rich Context: Add structured metadata to every log entry
- Customizable Serialization: Control exactly what gets serialized
- Web-First Design: Optimized for modern visualization in UIs
Advanced Features
- Formatter Ecosystem: Plugins for various output formats
- Integration with Popular Logging Frameworks: Works with
log,tracing, and more - Extension System: Add custom functionality without modifying core code
- Adaptive Serialization: Automatic handling of complex data types
- Smart Sanitization: Safe field names and values for JSON
- Performance Optimized: Built for high-throughput logging environments
📋 Examples
Basic Usage
use ;
// Create a simple log entry
let mut entry = new;
// Add structured context
entry.add_context?;
entry.add_context?;
// Convert to JSON
let json = entry.to_json?;
Custom Log Types
use Serializable;
use ;
// Serializable is automatically implemented for Serialize types
let request = ApiRequest ;
// One-line serialization
let json = request.to_json?;
Integration with the log Crate
use ;
use ;
// Initialize the adapter
let adapter = new;
// Use the standard log macros
info!;
warn!;
error!;
// Collect and convert logs
let records = // ... collect log records
for record in records
🧩 Extending
ChrysalisRS is designed for extension. Create custom log types, formatters, and more:
Custom Extensions
use ;
use Any;
// Register your extension
let mut registry = new;
registry.register?;
Custom Formatters
use ;
use Serialize;
;
🖥️ Web UI Integration
ChrysalisRS is optimized for web UI integration, making it easy to create interactive log viewers.
WebSocket Example
// Server-side code
let web_log = from;
ws.send?;
// Client-side JavaScript
socket.onmessage = function ;
UI-Specific Metadata
ChrysalisRS allows you to include UI-specific metadata with your logs:
// Create a log entry with UI metadata
let mut entry = new;
entry.add_context?;
entry.add_context?;
entry.add_context?;
📊 Performance
ChrysalisRS is designed for high-performance logging environments:
- Zero-copy when possible: Minimizes memory allocations
- Deferred serialization: Only convert to JSON when needed
- Efficient context storage: Optimized for fast lookups
- Minimal dependencies: Core functionality has few external dependencies
- Benchmark suite: Continuous performance testing
📦 Cargo Features
ChrysalisRS provides optional features that can be enabled in your Cargo.toml:
[]
= "0.1.0"
= ["tracing", "log", "async", "compression"]
Available features:
- tracing: Integration with the tracing crate
- log: Integration with the log crate
- async: Async support for non-blocking operations
- compression: Log compression for storage efficiency
- metrics: Built-in metrics collection
- security: Additional sanitization and security features
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development
# Clone the repository
# Build the project
# Run tests
# Run examples
Guidelines
- Follow the Rust API guidelines
- Add tests for new features
- Update documentation accordingly
- Maintain backward compatibility when possible
📄 License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.