Skip to content

Commit ea0bfe9

Browse files
committed
rotate fix
1 parent 41900fc commit ea0bfe9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/outputs/advanced_file_output.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ class AdvancedFileOutput extends LogOutput {
179179
await _file.length() > _maxFileSizeKB * 1024) {
180180
// Rotate the log file
181181
await _closeSink();
182-
await _file.rename('$_path/${_fileNameFormatter(DateTime.now())}');
182+
await _file.copy('$_path/${_fileNameFormatter(DateTime.now())}');
183183
await _deleteRotatedFiles();
184-
// Reset file ref to "latest"
185-
_file = maxFileSizeKB > 0 ? File('$path/$latestFileName') : File(path);
184+
// Clear contents of "latest"
185+
await _file.writeAsString("", mode: FileMode.write, flush: true);
186186
await _openSink();
187187
}
188188
} catch (e, s) {

0 commit comments

Comments
 (0)