-
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.
feat: move loggin from log to tracing crate
Current outpuit: ```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: ```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 ... ```
- Loading branch information
1 parent
213fcd3
commit f7f9aee
Showing
18 changed files
with
75 additions
and
70 deletions.
There are no files selected for viewing
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
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
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