Skip to content

Commit

Permalink
truncate log file when larger then 1GB
Browse files Browse the repository at this point in the history
  • Loading branch information
Kl4rry committed May 31, 2024
1 parent 2f9aa72 commit e6ab5ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ fn main() -> Result<ExitCode> {
.create(true)
.open(&log_file_path)?;

const GB: u64 = 1_000_000_000;
if log_file.metadata()?.len() > GB {
log_file.set_len(0)?;
}

let var = args
.log_level
.as_ref()
Expand Down

0 comments on commit e6ab5ac

Please sign in to comment.