From 7227cf2dd943711c92ccbfc1af25d4fe2368b9e1 Mon Sep 17 00:00:00 2001 From: asxalex Date: Wed, 31 Jan 2024 21:49:44 +0800 Subject: [PATCH] removed log info --- examples/tracing-log/main.rs | 3 --- examples/tracing-log/submod.rs | 1 - src/lib.rs | 13 ++----------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/examples/tracing-log/main.rs b/examples/tracing-log/main.rs index 54d87e4..c888057 100644 --- a/examples/tracing-log/main.rs +++ b/examples/tracing-log/main.rs @@ -1,7 +1,4 @@ use rolling_file::default; -use time::macros::{format_description, offset}; -use tracing_subscriber::fmt::time::OffsetTime; - mod submod; fn main() { diff --git a/examples/tracing-log/submod.rs b/examples/tracing-log/submod.rs index 35cd680..72a9c7b 100644 --- a/examples/tracing-log/submod.rs +++ b/examples/tracing-log/submod.rs @@ -1,4 +1,3 @@ -use tracing::Level; use tracing::{debug, error, info, trace, warn}; pub fn do_record() { diff --git a/src/lib.rs b/src/lib.rs index ceceb3b..2b67d50 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(())