diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-25 12:01:34 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-25 12:01:34 +0100 |
commit | 1cff44421bca4afa5512192b8b797c519b6020f1 (patch) | |
tree | 00180d9aa160113759cd4a2f31e497b2def116a1 | |
parent | 9805823fdd99fa32d5eda2b78c2d403ce22af33d (diff) |
add log messages to all endpoints
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 84e545e..91dfde1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,6 +167,8 @@ async fn handle_switch() -> HttpResponse { async fn handle_data_read(info: web::Query<DataRequest>) -> HttpResponse { let query = info.into_inner(); + println!("read {}", query.path); + match fs::read(&query.path) { Ok(data) => HttpResponse::Ok() .content_type(ContentType::octet_stream()) @@ -180,6 +182,8 @@ async fn handle_data_read(info: web::Query<DataRequest>) -> HttpResponse { async fn handle_data_write(info: web::Query<DataRequest>, data: web::Bytes) -> HttpResponse { let query = info.into_inner(); + println!("write {}", query.path); + match stream_to(&query.path, &data).await { Ok(_) => HttpResponse::Ok() .content_type(ContentType::plaintext()) @@ -193,6 +197,8 @@ async fn handle_data_write(info: web::Query<DataRequest>, data: web::Bytes) -> H async fn handle_data_list(info: web::Query<DataRequest>) -> HttpResponse { let query = info.into_inner(); + println!("list {}", query.path); + match fs::read_dir(&query.path) { Ok(ls) => HttpResponse::Ok() .content_type(ContentType::plaintext()) @@ -236,6 +242,8 @@ async fn handle_data_list(info: web::Query<DataRequest>) -> HttpResponse { async fn handle_data_mkdir(info: web::Query<DataRequest>) -> HttpResponse { let query = info.into_inner(); + println!("mkdir {}", query.path); + match fs::create_dir_all(&query.path) { Ok(_) => HttpResponse::Ok() .content_type(ContentType::plaintext()) @@ -249,6 +257,8 @@ async fn handle_data_mkdir(info: web::Query<DataRequest>) -> HttpResponse { async fn handle_data_remove(info: web::Query<DataRequest>) -> HttpResponse { let query = info.into_inner(); + println!("remove {}", query.path); + match fs::remove_file(&query.path) { Ok(_) => HttpResponse::Ok() .content_type(ContentType::plaintext()) @@ -262,6 +272,8 @@ async fn handle_data_remove(info: web::Query<DataRequest>) -> HttpResponse { async fn handle_data_removedir(info: web::Query<DataRequest>) -> HttpResponse { let query = info.into_inner(); + println!("removedir {}", query.path); + match fs::remove_dir_all(&query.path) { Ok(_) => HttpResponse::Ok() .content_type(ContentType::plaintext()) |