add trace debug level

This commit is contained in:
yggverse 2025-06-07 20:11:55 +03:00
parent b68a5b3eda
commit d0bd72396f
4 changed files with 8 additions and 2 deletions

View file

@ -18,4 +18,5 @@ librqbit = {version = "8.1.0", features = ["disable-upload"]}
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.45", features = ["full"] }
tracing-subscriber = "0.3"
url = "2.5.4"

View file

@ -47,7 +47,7 @@ aquatic-crawler --infohash-file /path/to/info-hash-ipv4.json\
-d, --debug <DEBUG>
Debug level
* `e` - error * `i` - info
* `e` - error * `i` - info * `t` - trace (e.g. to run with `RUST_LOG=librqbit=trace`)
[default: ei]

View file

@ -7,6 +7,7 @@ pub struct Argument {
///
/// * `e` - error
/// * `i` - info
/// * `t` - trace (e.g. to run with `RUST_LOG=librqbit=trace`)
#[arg(short, long, default_value_t = String::from("ei"))]
pub debug: String,

View file

@ -15,6 +15,10 @@ async fn main() -> anyhow::Result<()> {
let is_debug_i = argument.debug.contains("i");
let is_debug_e = argument.debug.contains("e");
if argument.debug.contains("t") {
tracing_subscriber::fmt::init()
}
// init shared members
let torrent_storage = if let Some(t) = argument.storage {
let s = database::torrent::Storage::init(&t, argument.clear)?;
@ -49,10 +53,10 @@ async fn main() -> anyhow::Result<()> {
let session = librqbit::Session::new_with_opts(
std::path::PathBuf::new(),
SessionOptions {
persistence: None,
disable_dht: !argument.enable_dht,
disable_upload: !argument.enable_upload,
enable_upnp_port_forwarding: argument.enable_upnp_port_forwarding,
persistence: None,
socks_proxy_url: argument.socks_proxy_url.clone(),
trackers: trackers.clone(),
..SessionOptions::default()