diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-06 01:29:45 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-06 01:29:49 +0100 |
commit | f73c32eea7d421ad17f69b0a174456554bc580f1 (patch) | |
tree | 8641a36ffe5a35e13a0a0a9abd0faa2262320094 /indexer/src/main.rs | |
parent | Readme: Improve run instructions with frontend auto-open (diff) | |
download | OSSE-f73c32eea7d421ad17f69b0a174456554bc580f1.tar.gz OSSE-f73c32eea7d421ad17f69b0a174456554bc580f1.tar.bz2 OSSE-f73c32eea7d421ad17f69b0a174456554bc580f1.zip |
Indexer: Add logging with env_logger
Diffstat (limited to '')
-rw-r--r-- | indexer/src/main.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 592a0a6..515062d 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -30,7 +30,9 @@ struct AppState { #[actix_web::main] async fn main() -> std::io::Result<()> { - println!("Hello, world! Im the indexer!"); + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + + log::info!("Hello, world! Im the indexer!"); serve_http_endpoint("0.0.0.0", 4444).await } @@ -55,6 +57,8 @@ async fn serve_http_endpoint(address: &str, port: u16) -> std::io::Result<()> { //TODO: Max description size //TODO: Current result below search bar updates with it +//TODO: Remove html symbols italic and stuff in frontend (or apply them?) +//TODO: Better readme //TODO: sufficiently simmilar word in search (algorithm) #[post("/api/resource")] @@ -88,7 +92,7 @@ async fn add_resource( .filter(|w: &String| !w.is_empty()) .collect(); - println!("xd: {:?}", fixed_words); + log::debug!("xd: {:?}", fixed_words); let title_selector = scraper::Selector::parse("title").unwrap(); let meta_selector = scraper::Selector::parse("meta").unwrap(); @@ -141,7 +145,7 @@ async fn add_resource( //Now what to do, global lang?, per index lang?, website lang? //TODO: max number of results in query - println!("Added resource: {:?}", indexer.num_of_words()); + log::debug!("Added resource: {:?}", indexer.num_of_words()); format!("{resource:?}") } @@ -161,7 +165,7 @@ async fn search( None => return "[]".to_string(), }; - println!("Query: {:?}", query); + log::debug!("Query: {:?}", query); let results = data.indexer.lock().unwrap().search(query); //indexer is slow (gets stuck when inserting stuff) |