60 releases (stable)
2.8.0-beta.2 | Jan 5, 2024 |
---|---|
2.8.0-beta.1 | Sep 10, 2023 |
2.7.0 | Nov 30, 2020 |
2.5.2 | Jul 22, 2019 |
0.6.0 | Jul 19, 2016 |
#42 in Debugging
553,703 downloads per month
Used in 571 crates
(380 directly)
160KB
3K
SLoC
Getting started
Introduction
FAQ
Crate list
slog-rs - The Logging for Rust
You might consider using tracing
instead
It's been a while since slog
was created and it served
Rust community well all this time. It remains a stable, featureful
and battle-tested library, used in many important projects.
In last few years,
another ecosystem for Rust was
created with similar features and a very good support for debugging async
code
and already larger dev team and community.
Please check tracing and see if it is more suitable for your use-case. It seems that it is already a go-to logging/tracing solution for Rust.
Reasons you might want to stick with slog
anyway:
async
support doesn't benefit you- you consider mature, stable code & API a plus
- it has some features that
tracing
is missing - great performance (I have NOT done any comparison, but
slog
's performance is very good).
Introduction (please read)
slog
is an ecosystem of reusable components for structured, extensible,
composable and contextual logging for Rust.
The ambition is to be The Logging Library for Rust. slog
should accommodate a
variety of logging features and requirements. If there is a feature that you
need and standard log
crate is missing, slog
should have it.
This power comes with a little steeper learning curve, so if you experience any problems, please join slog-rs gitter channel to get up to speed. If you'd like to take a quick, convenient route, consider using sloggers wrapper library.
While the code is reliable, the documentation sometimes could use an improvement. Please report all issues and ideas.
Features & technical documentation
Most of the interesting documentation is auto-generated and hosted on https://docs.rs.
Go to docs.rs/slog to read about features and APIs (examples included).
Note: slog
is just a core, and the actual functionality is inside
many feature crates. To name a few:
- slog-term for terminal output
- slog-async for asynchronous logging
- slog-json for logging JSON
- slog-syslog for logging to syslog
- sloggers for convenience methods (note: 3rd-party library)
There are many more slog feature crates. Search for more slog features on crates.io. It is easy to write and publish new ones. Look through all the existing crates using slog for examples and ideas.
Terminal output example
slog-term
is only one of many slog
features - useful showcase,
multi-platform, and featuring eg. automatic TTY detection and colors.
See following screenshot: same output in both compact and full output mode.
Using & help
Please use slog-rs gitter channel to ask for help or discuss slog features.
See examples/features.rs for full quick code example overview.
Read Documentation for details and features.
To report a bug or ask for features use github issues.
Slog community
Slog related crates are hosted under slog github organization.
Dawid Ciężarkiewicz is the original author and current maintainer of slog
and
therefore self-appointed benevolent dictator over the project. When working on
slog Dawid follows and expects everyone to follow his Code of
Conduct.
Any particular repositories under slog ecosystem might be created, controlled, maintained by other entities with various levels of autonomy. Lets work together toward a common goal in a respectful and welcoming atmosphere!
Verification Recommendation
To help with the maintained, the ownership of this crate is potentially shared between multiple developers. It is recommended to always use cargo-crev to verify the trustworthiness of each of your dependencies, including this one.
Dependencies
~195KB