Expand description
§Telelog - High-Performance Structured Logging
Telelog is a high-performance logging library for Rust that provides:
- Structured JSON-first logging
- Performance profiling and monitoring
- Cross-language bindings support
- System resource monitoring
- Context management and decorators
- Thread-local buffer pooling for reduced allocations
§Quick Start
use telelog::{Logger, LogLevel};
let logger = Logger::new("my_app");
logger.info("Application started");
// With structured data
logger.info_with("User logged in", &[
("user_id", "12345"),
("session_id", "abcdef"),
]);
// Performance profiling
let _guard = logger.profile("expensive_operation");
// Your expensive operation here
§Async Support
Enable the async
feature for bounded async output with backpressure:
ⓘ
use telelog::{Logger, AsyncOutput};
#[tokio::main]
async fn main() {
let logger = Logger::new("app");
let mut async_output = AsyncOutput::new();
logger.add_output(Box::new(async_output));
logger.info("Async logging!");
}
§Performance
- ~788ns per log with thread-local buffer pooling
- ~11ns level check overhead (nearly free when filtered)
- Bounded async channels with backpressure (capacity: 1000)
§Features
- Thread-safe logging with parking_lot
- Optimized allocations with thread-local buffer pooling
- Optional features: async, system-monitor, console, python
Re-exports§
pub use component::Component;
pub use component::ComponentGuard;
pub use component::ComponentMetadata;
pub use component::ComponentStatus;
pub use component::ComponentTracker;
pub use config::Config;
pub use context::Context;
pub use context::ContextGuard;
pub use level::LogLevel;
pub use logger::Logger;
pub use output::BufferedOutput;
pub use output::LogMessage;
pub use profile::ProfileGuard;
pub use visualization::ChartConfig;
pub use visualization::ChartType;
pub use visualization::Direction;
pub use visualization::MermaidGenerator;
pub use monitor::SystemMonitor;
Modules§
- component
- Component tracking for hierarchical visualization and performance analysis.
- config
- Configuration management for telelog with preset configurations.
- context
- Context management for structured logging with automatic cleanup.
- level
- Log level definitions and utilities for filtering and formatting.
- logger
- Core logger implementation providing structured logging, profiling, and component tracking.
- monitor
- System resource monitoring utilities.
- output
- Output destination management for log messages.
- profile
- Performance profiling utilities with automatic timing.
- visualization
- Mermaid diagram generation for component visualization.
Constants§
Functions§
- init
- Initialize telelog with default configuration.
- init_
with_ config - Initialize telelog with custom configuration