Skip to content

Commit

Permalink
feat: Move request logs into a subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
MrExplode committed Nov 2, 2023
1 parent 3b404e6 commit 3b0e4ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jira.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::sync::Arc;
use std::{env, path::Path};

use actix_web::{
post,
Expand Down Expand Up @@ -54,7 +54,8 @@ async fn handle(info: web::Query<Info>, body: String, clients: Data<Arc<Clients>
}

fn log_request(data: &String) -> std::io::Result<()> {
let mut file = File::create(format!("request_{}.json", Utc::now().format("%m-%d_%H-%M-%S")))?;
std::fs::create_dir_all(Path::new("requests/"))?;
let mut file = File::create(format!("requests/request_{}.json", Utc::now().format("%m-%d_%H-%M-%S")))?;
file.write_all(data.as_bytes())?;
Ok(())
}
Expand Down

0 comments on commit 3b0e4ac

Please sign in to comment.