add feature flag to enable tracing instead of log

This commit is contained in:
OMGeeky
2023-06-01 21:45:13 +02:00
parent 1b9f6635e2
commit 817f36742d
4 changed files with 16 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
downloader_config = { git = "https://github.com/OMGeeky/downloader_config" }
exponential_backoff = { version="0.1.3", git = "https://github.com/OMGeeky/exponential_backoff" }
exponential_backoff = { version="0.2", git = "https://github.com/OMGeeky/exponential_backoff" }
google-youtube3 = "5.0.2"
@@ -19,8 +19,14 @@ serde_json = "1.0"
async-trait = "0.1.60"
strfmt = "0.2.2"
log = "0.4.17"
log = "0.4"
simplelog = "0.12.1"
#[patch.crates-io.yup-oauth2]
#path = "../../Documents/GitHub/OMGeeky/yup-oauth2"
#version = "7.1.0"
tracing = { version = "0.1", optional = true }
[features]
default = []
tracing = ["dep:tracing","exponential_backoff/tracing", "downloader_config/tracing"]

View File

@@ -1,4 +1,5 @@
use log::{debug, error, info, trace, warn};
use crate::prelude::*;
use std::default::Default;
use std::error::Error;
use std::path::{Path, PathBuf};
@@ -24,6 +25,7 @@ use youtube::{hyper, hyper_rustls::HttpsConnectorBuilder};
mod auth;
pub mod scopes;
pub mod prelude;
// mod config;
pub struct YoutubeClient {

View File

@@ -1,4 +1,4 @@
use log::{debug, error, info, trace, warn};
use google_youtube::prelude::*;
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};