All of the aforementioned crates are quite useful and are ideal for most use cases, but they do not support structured logging. In this section, we'll see how structured logging can be integrated into our application using the slog crate, one of the few popular structured logging crates in the Rust ecosystem. For this demo, we'll create a new project by running cargo new slog_demo, which simulates a shooting game.
We'll need the following dependencies in our Cargo.toml file:
# slog_demo/Cargo.toml[dependencies]rand = "0.5.5"slog = "2.4.1"slog-async = "2.3.0"slog-json = "2.2.0"
The slog framework is ideal for moderate to big projects where there is lot of interplay between modules as it helps to integrate detailed ...