spdlog-rs: Fast and combinable Rust logging crate
11 months ago, I created the spdlog-rs project, inspired by the spdlog library I was using in my C++ project.
crates-io: https://crates.io/crates/spdlog-rs
GitHub: https://github.com/SpriteOvO/spdlog-rs
So, spdlog-rs also aims to be fast, flexible and combinable. Meanwhile, spdlog-rs v0.3 was recently released, and it brings a lot of exciting features, I would like to talk about them briefly.
Fast
Here's a benchmark ^1 of spdlog-rs and other popular Rust logging crates.
The optional asynchronous support added in v0.3 further improves the performance of spdlog-rs.
Flexible and Combinable
In spdlog-rs, users can optionally create multiple Loggers for different components and combine Sinks in any way they want.
Currently the basic sinks StdStreamSink (supports style), FileSink, RotatingFileSink (supports rotating by file size, time point), etc. are ready to go. In the future we plan to implement (or better by contributors) more third-party external service sink crates. (e.g. UDP, database, email, IRC or even IM)
The new PatternFormatter in v0.3 also supports users to configure logging formats using a literal string at compile-time. You don't need to tediously implement your own structures manually, just one line to customize them at compile-time.
What's next
Discover implementing serialization and deserialization for sinks, for easily load from configuration files.
Implement sink crates to connect with third-party services.
Consider supporting width, padding/alignment for
pattern!macro....
^1: As a disclaimer, I'm not entirely familiar with the use of other Rust logging crates, so if you find a bug or something worth improving in the benchmark code, please feel free to open an issue to let me know and I'll update the results once confirmed.