removed log info

This commit is contained in:
asxalex 2024-01-31 21:49:44 +08:00
parent b1fd4f2b9e
commit 7227cf2dd9
3 changed files with 2 additions and 15 deletions

View File

@ -1,7 +1,4 @@
use rolling_file::default;
use time::macros::{format_description, offset};
use tracing_subscriber::fmt::time::OffsetTime;
mod submod;
fn main() {

View File

@ -1,4 +1,3 @@
use tracing::Level;
use tracing::{debug, error, info, trace, warn};
pub fn do_record() {

View File

@ -49,15 +49,13 @@ impl FileRoller {
}
let logdir = current_dir.as_path().join(path);
// let current_gap = get_current_gap(&period);
let res = Self {
Self {
base_dir: OsString::from(logdir.as_os_str()),
max_files,
writer: None,
current_gap: 0,
period,
};
println!("got log dir: {:?}", res.base_dir);
res
}
}
fn rollover(&mut self) -> anyhow::Result<()> {
@ -66,15 +64,10 @@ impl FileRoller {
return Ok(());
}
self.current_gap = now;
println!("flushing 1");
self.flush()?;
println!("flushing 2");
self.writer.take();
println!("flushing 3");
self.open_writer_if_needed()?;
println!("flushing 4");
let _ = self.delete_old_file();
println!("flushing 5");
Ok(())
}
@ -110,13 +103,11 @@ impl FileRoller {
self.current_gap = gap;
let basepath = PathBuf::from(&self.base_dir).join(format!("{}.log", gap));
let filename = basepath.as_path();
println!("opening filename: {:?}", filename);
let fin = OpenOptions::new()
.append(true)
.create(true)
// .write(true)
.open(filename)?;
println!("write ok");
self.writer = Some(BufWriter::new(fin));
}
Ok(())