RotatingFileAppender constructor
RotatingFileAppender({
- LogRecordFormatter? formatter,
- required String baseFilePath,
- int keepRotateCount = 3,
- int rotateAtSizeBytes = 10 * 1024 * 1024,
- Duration rotateCheckInterval = const Duration(minutes: 5),
- Clock clock = const Clock(),
Implementation
RotatingFileAppender({
LogRecordFormatter? formatter,
required this.baseFilePath,
this.keepRotateCount = 3,
this.rotateAtSizeBytes = 10 * 1024 * 1024,
this.rotateCheckInterval = const Duration(minutes: 5),
this.clock = const Clock(),
}) : super(formatter) {
_outputFile = File(baseFilePath);
if (!_outputFile.parent.existsSync()) {
throw StateError(
'When initializing file logger, ${_outputFile.parent} must exist.');
}
_maybeRotate();
}