logroller-0.1.5 has been yanked.
LogRoller 🪵
LogRoller is a Rust library for efficient log writing and file rotation. It provides a simple API for writing logs to files and automatically rotating them based on size or time. And it works seamlessly with the tracing-appender crate for use with the tracing framework.
Features ✨
- Log Writing: Write logs to files with ease.
- File Rotation: Automatically rotate log files based on size or time.
- Configurable: Easily customize rotation strategies and settings.
- Time Zones: Rotate logs according to the local or UTC time zone.
- Thread-safe: Designed for safe concurrent usage.
- Tracing Support: Use LogRoller as a file appender for the
tracingframework. - Compression: Compress rotated log files with Gzip.
Usage 🚀
Add logroller to your Cargo.toml:
[]
= "0.1"
1. Use logroller as a simple logger
Create a new LogRoller instance and write logs to it:
use ;
use Write;
2. Use logroller with tracing and tracing-appender
logroller can be used as a file appender for the tracing-appender crate, by enabling the tracing feature:
[]
= { = "0.1", = ["tracing"] }
tracing-appender only supports rotating logs according to the UTC time zone. logroller can rotate logs according to the local time zone.
use ;
use SubscriberInitExt;