-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
f6bace6 feat: move loggin from log to tracing crate (Jose Celano) 213fcd3 chore(deps): [#621] add cargo dependency: tracing-subscriber (Jose Celano) Pull request description: Move from `log` to `tracing` crate. Old output: ```output $ cargo run Compiling torrust-index v3.0.0-alpha.3-develop (/home/josecelano/Documents/github/committer/me/torrust/torrust-index) Finished `dev` profile [unoptimized + debuginfo] target(s) in 12.31s Running `target/debug/torrust-index` Loading configuration from default configuration file: `./share/default/config/index.development.sqlite3.toml` ... 2024-06-07T15:35:08.192302724+01:00 [torrust_index::bootstrap::logging][INFO] logging initialized. 2024-06-07T15:35:08.252784599+01:00 [torrust_index::web::api::server][INFO] TLS not enabled 2024-06-07T15:35:08.252892290+01:00 [torrust_index::console::cronjobs::tracker_statistics_importer][INFO] Tracker statistics importer launcher started 2024-06-07T15:35:08.252979221+01:00 [torrust_index::console::cronjobs::tracker_statistics_importer][INFO] Tracker statistics importer cronjob starting ... 2024-06-07T15:35:08.252977224+01:00 [torrust_index::web::api::server][INFO] Starting API server with net config: 0.0.0.0:3001 ... 2024-06-07T15:35:08.253260311+01:00 [torrust_index::console::cronjobs::tracker_statistics_importer][INFO] Tracker statistics importer API server listening on http://127.0.0.1:3002 2024-06-07T15:35:08.254122817+01:00 [torrust_index::console::cronjobs::tracker_statistics_importer][INFO] Running tracker statistics importer every 2000 milliseconds ... 2024-06-07T15:35:08.254518031+01:00 [torrust_index::web::api::server][INFO] API server listening on http://0.0.0.0:3001 2024-06-07T15:35:08.284476791+01:00 [Tracker Stats Importer][INFO] Importing 1 torrents statistics from tracker udp://localhost:6969 ... ``` New output: ``` $ cargo run Blocking waiting for file lock on build directory Compiling torrust-index v3.0.0-alpha.3-develop (/home/josecelano/Documents/github/committer/me/torrust/torrust-index) Finished `dev` profile [unoptimized + debuginfo] target(s) in 52.26s Running `target/debug/torrust-index` Loading configuration from default configuration file: `./share/default/config/index.development.sqlite3.toml` ... 2024-06-07T16:50:05.192713Z INFO torrust_index::bootstrap::logging: logging initialized. 2024-06-07T16:50:05.352161Z INFO torrust_index::web::api::server: TLS not enabled 2024-06-07T16:50:05.352303Z INFO torrust_index::console::cronjobs::tracker_statistics_importer: Tracker statistics importer launcher started 2024-06-07T16:50:05.352318Z INFO torrust_index::web::api::server: Starting API server with net config: 0.0.0.0:3001 ... 2024-06-07T16:50:05.352363Z INFO torrust_index::console::cronjobs::tracker_statistics_importer: Tracker statistics importer cronjob starting ... 2024-06-07T16:50:05.352828Z INFO torrust_index::console::cronjobs::tracker_statistics_importer: Tracker statistics importer API server listening on http://127.0.0.1:3002 2024-06-07T16:50:05.353605Z INFO torrust_index::console::cronjobs::tracker_statistics_importer: Running tracker statistics importer every 2000 milliseconds ... 2024-06-07T16:50:05.356876Z INFO torrust_index::web::api::server: API server listening on http://0.0.0.0:3001 2024-06-07T16:50:05.428304Z INFO Tracker Stats Importer: Importing 1 torrents statistics from tracker udp://localhost:6969 ... ``` ACKs for top commit: josecelano: ACK f6bace6 Tree-SHA512: 812fe3b62efeb227b5aa73c78c6a38fff4569576ebe286799f228f76e76b5a992bd0943d482f9eee09ddd24fcbc15569e46e733c9c601b557710eb8febf9f5eb
- Loading branch information
Showing
21 changed files
with
161 additions
and
72 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
//! Logging setup for the `seeder`. | ||
use log::{debug, LevelFilter}; | ||
use tracing::debug; | ||
use tracing::level_filters::LevelFilter; | ||
|
||
/// # Panics | ||
/// | ||
/// | ||
pub fn setup(level: LevelFilter) { | ||
if let Err(_err) = fern::Dispatch::new() | ||
.format(|out, message, record| { | ||
out.finish(format_args!( | ||
"{} [{}][{}] {}", | ||
chrono::Local::now().format("%+"), | ||
record.target(), | ||
record.level(), | ||
message | ||
)); | ||
}) | ||
.level(level) | ||
.chain(std::io::stdout()) | ||
.apply() | ||
{ | ||
panic!("Failed to initialize logging.") | ||
} | ||
tracing_subscriber::fmt().with_max_level(level).init(); | ||
|
||
debug!("logging initialized."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.