newline delimit audit logs
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
9d883b5851
commit
56c7391cd5
1 changed files with 3 additions and 1 deletions
|
@ -5,6 +5,7 @@ use reqwest::Url;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
|
use std::io::Write;
|
||||||
use std::sync::atomic::AtomicU32;
|
use std::sync::atomic::AtomicU32;
|
||||||
use std::{collections::HashMap, fmt::Debug, ops::DerefMut, path::PathBuf, sync::Arc};
|
use std::{collections::HashMap, fmt::Debug, ops::DerefMut, path::PathBuf, sync::Arc};
|
||||||
use tokio::sync::{Mutex, RwLock};
|
use tokio::sync::{Mutex, RwLock};
|
||||||
|
@ -117,7 +118,6 @@ impl AuditState {
|
||||||
|
|
||||||
let file = OpenOptions::new()
|
let file = OpenOptions::new()
|
||||||
.create(true)
|
.create(true)
|
||||||
|
|
||||||
.append(true)
|
.append(true)
|
||||||
.open(self.options.output.join(&full_name))?;
|
.open(self.options.output.join(&full_name))?;
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ impl AuditState {
|
||||||
let mut f = file.lock().await;
|
let mut f = file.lock().await;
|
||||||
|
|
||||||
serde_json::to_writer(f.deref_mut(), &item)?;
|
serde_json::to_writer(f.deref_mut(), &item)?;
|
||||||
|
write!(f.deref_mut(), "\n\n")?;
|
||||||
|
|
||||||
let meta = f.get_ref().metadata()?;
|
let meta = f.get_ref().metadata()?;
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@ impl AuditState {
|
||||||
let file = read.get(name).unwrap();
|
let file = read.get(name).unwrap();
|
||||||
|
|
||||||
serde_json::to_writer(file.lock().await.deref_mut(), &item)?;
|
serde_json::to_writer(file.lock().await.deref_mut(), &item)?;
|
||||||
|
write!(file.lock().await.deref_mut(), "\n\n")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue