add feature flag to enable tracing instead of log

This commit is contained in:
OMGeeky
2023-06-01 22:11:51 +02:00
parent 61762208ad
commit e369535b23
4 changed files with 18 additions and 7 deletions

View File

@@ -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"]

View File

@@ -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 {

View File

@@ -1,4 +1,4 @@
use log::info;
use twitch_data::prelude::info;
use std::error::Error;
use std::path::Path;

4
src/prelude.rs Normal file
View File

@@ -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};