#log-level #logging #log #log-format #env-var #spdlog #async

spdlog-rs

Fast, highly configurable Rust logging crate, inspired by the C++ logging library spdlog

23 releases

0.4.0 Oct 7, 2024
0.3.13 Feb 11, 2024
0.3.12 Oct 11, 2023
0.3.10 Jul 13, 2023
0.2.4 Mar 2, 2022

#93 in Debugging

Download history 246/week @ 2024-07-27 128/week @ 2024-08-03 146/week @ 2024-08-10 195/week @ 2024-08-17 120/week @ 2024-08-24 123/week @ 2024-08-31 146/week @ 2024-09-07 176/week @ 2024-09-14 194/week @ 2024-09-21 306/week @ 2024-09-28 345/week @ 2024-10-05 218/week @ 2024-10-12 181/week @ 2024-10-19 226/week @ 2024-10-26 345/week @ 2024-11-02 275/week @ 2024-11-09

1,057 downloads per month
Used in 8 crates (6 directly)

MIT/Apache and maybe LGPL-2.1-or-later WITH GCC-exception-2.0

400KB
9K SLoC

spdlog-rs

Fast, highly configurable Rust logging crate, inspired by the C++ logging library spdlog.

Features

  • Very fast (see Benchmarks).
  • Asynchronous support.
  • Compatible with log crate.
  • Custom log formats:
    • compile-time zero-cost pattern or runtime pattern;
    • manually implementing for more flexibility.
  • Various combinable sinks:
    • standard streams with optional color support;
    • files (single file, rotating hourly, daily, periodically or by file size);
    • platform-specific (e.g. journald for Linux and OutputDebugStringW for Windows);
    • ... and able to implement one yourself.
  • Configuring via environment variables or TOML[^1].
  • More readable level filters.

[^1]: TOML deserialization support is working in progress, tracking issue #25

Getting started

Add this to Cargo.toml:

[dependencies]
spdlog-rs = "0.4"

The documentation of this crate is hosted on docs.rs, and you can learn examples under ./examples directory along with it.

If you have any trouble while using this crate, please don't hesitate to open a discussion for help. For feature requests or bug reports, please open an issue.

Supported Rust versions

The current minimum supported Rust version is 1.60.

spdlog-rs is built against the latest Rust stable release, it is not guaranteed to build on Rust versions earlier than the minimum supported version.

spdlog-rs follows the compiler support policy that the latest stable version and the 3 most recent minor versions before that are always supported. For example, if the current latest Rust stable version is 1.61, the minimum supported version will not be increased past 1.58. Increasing the minimum supported version is not considered a semver breaking change as long as it complies with this policy.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2–10MB
~100K SLoC