diff --git a/Cargo.toml b/Cargo.toml index 7bdc014..75ae3a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twitch_data" -version = "0.1.8" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,8 +14,8 @@ reqwest = { version = "0.11", features = ["default", "stream"] } #twitch_api = { version = "0.7.0-rc.3", features = ["helix", "client", "twitch_oauth2", "reqwest"] } tokio = { version = "1.23", features = ["full", "macros"] } twitch_api = { version = "0.7.0-rc.4", features = ["all", "reqwest"] } -twitch_types = { version = "0.3.11" , features = ["stream", "timestamp", "default"] } -twitch_oauth2 = "0.10.0" +twitch_types = { version = "0.4.1", features = ["stream", "timestamp", "default"] } +twitch_oauth2 = "0.12.4" serde = "1.0.152" serde_json = "1.0.91" @@ -24,5 +24,12 @@ chrono = "0.4" indicatif = "0.17" futures = "0.3" async-recursion = "1.0.0" -log = "0.4.17" +log = "0.4" simplelog = "0.12.1" + + + +tracing = { version = "0.1", optional = true } + +[features] +tracing = ["dep:tracing","downloader_config/tracing", "exponential_backoff/tracing"] diff --git a/src/lib.rs b/src/lib.rs index 89bee83..5739d2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ use exponential_backoff::twitch::{ check_backoff_twitch_with_client, }; use futures::future::join_all; -use log::{debug, error, info, trace, warn}; +use crate::prelude::*; use reqwest; use serde::{Deserialize, Serialize}; use tokio::fs::File; @@ -25,7 +25,7 @@ use twitch_api::helix::videos::Video as TwitchVideo; use twitch_api::types::{Timestamp, VideoPrivacy}; use twitch_oauth2::{ClientId, ClientSecret}; pub use twitch_types::{UserId, VideoId}; - +pub mod prelude; //region DownloadError #[derive(Debug, Clone)] pub struct DownloadError { diff --git a/src/main.rs b/src/main.rs index afcf626..509e08c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use log::info; +use twitch_data::prelude::info; use std::error::Error; use std::path::Path; diff --git a/src/prelude.rs b/src/prelude.rs new file mode 100644 index 0000000..aa693b5 --- /dev/null +++ b/src/prelude.rs @@ -0,0 +1,4 @@ +#[cfg(not(feature = "tracing"))] +pub use log::{debug, error, info, trace, warn}; +#[cfg(feature = "tracing")] +pub use tracing::{debug, error, info, trace, warn};