Skip to content

Commit

Permalink
rotate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenboye committed Sep 22, 2024
1 parent 41900fc commit ea0bfe9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/outputs/advanced_file_output.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ class AdvancedFileOutput extends LogOutput {
await _file.length() > _maxFileSizeKB * 1024) {
// Rotate the log file
await _closeSink();
await _file.rename('$_path/${_fileNameFormatter(DateTime.now())}');
await _file.copy('$_path/${_fileNameFormatter(DateTime.now())}');
await _deleteRotatedFiles();
// Reset file ref to "latest"
_file = maxFileSizeKB > 0 ? File('$path/$latestFileName') : File(path);
// Clear contents of "latest"
await _file.writeAsString("", mode: FileMode.write, flush: true);
await _openSink();
}
} catch (e, s) {
Expand Down

0 comments on commit ea0bfe9

Please sign in to comment.