mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 09:05:33 +00:00
add trace debug level
This commit is contained in:
parent
b68a5b3eda
commit
d0bd72396f
4 changed files with 8 additions and 2 deletions
|
|
@ -18,4 +18,5 @@ librqbit = {version = "8.1.0", features = ["disable-upload"]}
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tokio = { version = "1.45", features = ["full"] }
|
tokio = { version = "1.45", features = ["full"] }
|
||||||
|
tracing-subscriber = "0.3"
|
||||||
url = "2.5.4"
|
url = "2.5.4"
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ aquatic-crawler --infohash-file /path/to/info-hash-ipv4.json\
|
||||||
-d, --debug <DEBUG>
|
-d, --debug <DEBUG>
|
||||||
Debug level
|
Debug level
|
||||||
|
|
||||||
* `e` - error * `i` - info
|
* `e` - error * `i` - info * `t` - trace (e.g. to run with `RUST_LOG=librqbit=trace`)
|
||||||
|
|
||||||
[default: ei]
|
[default: ei]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ pub struct Argument {
|
||||||
///
|
///
|
||||||
/// * `e` - error
|
/// * `e` - error
|
||||||
/// * `i` - info
|
/// * `i` - info
|
||||||
|
/// * `t` - trace (e.g. to run with `RUST_LOG=librqbit=trace`)
|
||||||
#[arg(short, long, default_value_t = String::from("ei"))]
|
#[arg(short, long, default_value_t = String::from("ei"))]
|
||||||
pub debug: String,
|
pub debug: String,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let is_debug_i = argument.debug.contains("i");
|
let is_debug_i = argument.debug.contains("i");
|
||||||
let is_debug_e = argument.debug.contains("e");
|
let is_debug_e = argument.debug.contains("e");
|
||||||
|
|
||||||
|
if argument.debug.contains("t") {
|
||||||
|
tracing_subscriber::fmt::init()
|
||||||
|
}
|
||||||
|
|
||||||
// init shared members
|
// init shared members
|
||||||
let torrent_storage = if let Some(t) = argument.storage {
|
let torrent_storage = if let Some(t) = argument.storage {
|
||||||
let s = database::torrent::Storage::init(&t, argument.clear)?;
|
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(
|
let session = librqbit::Session::new_with_opts(
|
||||||
std::path::PathBuf::new(),
|
std::path::PathBuf::new(),
|
||||||
SessionOptions {
|
SessionOptions {
|
||||||
persistence: None,
|
|
||||||
disable_dht: !argument.enable_dht,
|
disable_dht: !argument.enable_dht,
|
||||||
disable_upload: !argument.enable_upload,
|
disable_upload: !argument.enable_upload,
|
||||||
enable_upnp_port_forwarding: argument.enable_upnp_port_forwarding,
|
enable_upnp_port_forwarding: argument.enable_upnp_port_forwarding,
|
||||||
|
persistence: None,
|
||||||
socks_proxy_url: argument.socks_proxy_url.clone(),
|
socks_proxy_url: argument.socks_proxy_url.clone(),
|
||||||
trackers: trackers.clone(),
|
trackers: trackers.clone(),
|
||||||
..SessionOptions::default()
|
..SessionOptions::default()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue