RotatingFileAppender constructor

RotatingFileAppender({
  1. LogRecordFormatter? formatter,
  2. required String baseFilePath,
  3. int keepRotateCount = 3,
  4. int rotateAtSizeBytes = 10 * 1024 * 1024,
  5. Duration rotateCheckInterval = const Duration(minutes: 5),
  6. 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();
}