MCPcopy Create free account
hub / github.com/GCWing/BitFun / rotate

Method rotate

src/apps/cli/src/logging.rs:82–93  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

80 }
81
82 fn rotate(&mut self) -> std::io::Result<()> {
83 if let Some(mut file) = self.inner.take() {
84 let _ = file.flush();
85 }
86
87 if self.path.exists() {
88 self.remove_old_files(ROTATED_LOG_KEEP_COUNT.saturating_sub(1))?;
89 self.rename_file_to_dated()?;
90 }
91
92 self.open_file()
93 }
94
95 fn remove_old_files(&self, keep_count: usize) -> std::io::Result<()> {
96 let mut files = fs::read_dir(&self.dir)?

Callers 2

newMethod · 0.80
flushMethod · 0.80

Calls 6

takeMethod · 0.80
remove_old_filesMethod · 0.80
rename_file_to_datedMethod · 0.80
flushMethod · 0.45
existsMethod · 0.45
open_fileMethod · 0.45

Tested by

no test coverage detected