add feature to switch log to tracing

This commit is contained in:
OMGeeky
2023-06-01 22:20:37 +02:00
parent 713ec66ef1
commit 2c43ba9e5a
6 changed files with 24 additions and 2582 deletions

2574
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "downloader"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -8,12 +8,11 @@ edition = "2021"
[dependencies]
google_bigquery_v2 = { version = "0.2", git = "https://github.com/OMGeeky/google_bigquery_v2" }
google_youtube = { version = "0.1", git = "https://github.com/OMGeeky/google_youtube" }
twitch_data = { version = "0.1", git = "https://github.com/OMGeeky/twitch_data" }
downloader_config = { version = "0.4.2", git = "https://github.com/OMGeeky/downloader_config" }
twitch_data = { version = "0.2", git = "https://github.com/OMGeeky/twitch_data" }
downloader_config = { version = "0.4", git = "https://github.com/OMGeeky/downloader_config" }
tokio = "1.23"
chrono = "0.4.23"
nameof = "1.2.2"
log = "0.4.17"
simplelog = "0.12.1"
log4rs = { version = "1.2.0", features = ["compound_policy", "default", "size_trigger", "all_components", "gzip"] }
path-clean = "1.0.1"
@@ -21,3 +20,15 @@ path-clean = "1.0.1"
log-panics = { version = "2", features = ["with-backtrace"] }
env_logger = "0.10.0"
anyhow = "1.0.70"
log = { version = "0.4" }
tracing = { version = "0.1", optional = true }
[features]
default = []
tracing = ["dep:tracing",
"google_bigquery_v2/tracing",
"google_youtube/tracing",
"twitch_data/tracing",
"downloader_config/tracing",
]

View File

@@ -12,7 +12,6 @@ use downloader_config;
use downloader_config::Config;
use google_bigquery_v2::prelude::*;
use google_youtube::{scopes, PrivacyStatus, YoutubeClient};
use log::{debug, error, info, trace, warn};
use nameof::name_of;
use path_clean::clean;
use tokio::io::BufReader;

View File

@@ -8,7 +8,7 @@ use anyhow::{anyhow, Result};
use google_bigquery_v2::prelude::*;
use google_youtube::scopes;
use google_youtube::YoutubeClient;
use log::{debug, error, info, trace, warn};
use downloader::prelude::*;
use log4rs::append::console::ConsoleAppender;
use log4rs::append::rolling_file::policy::compound::roll;
use log4rs::append::rolling_file::policy::compound::roll::fixed_window::FixedWindowRoller;

View File

@@ -1 +1,8 @@
#[cfg(not(feature = "tracing"))]
use log::{debug, error, info, trace, warn};
#[cfg(feature = "tracing")]
pub use tracing::{debug, error, info, trace, warn};
pub use log::LevelFilter;

View File

@@ -3,8 +3,7 @@ use std::path::{Path, PathBuf};
use chrono::{DateTime, NaiveDateTime, Utc};
// use bigquery_googleapi::BigqueryClient;
use google_bigquery_v2::prelude::*;
use log::LevelFilter;
use log::{debug, info};
use downloader::prelude::*;
use downloader;
use downloader::data::{Streamers, VideoData, VideoMetadata, Videos};