FileLogStorage constructor

FileLogStorage({
  1. required String directory,
  2. String? sessionId,
  3. Map<String, Object?>? meta,
  4. int minLevel = LogLevels.all,
  5. int? maxTotalSize,
  6. int maxSessionSize = 10 * 1024 * 1024,
  7. int maxChunkSize = 1024 * 1024,
  8. Duration? maxAge = const Duration(days: 7),
  9. FileLogDataFormat dataFormat = FileLogDataFormat.text,
  10. LogMainTheme? theme,
  11. LoggableConfig config = const LoggableConfig(),
  12. LoggableJsonConfig jsonConfig = const LoggableJsonConfig(),
  13. void onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
  14. void onDropped(
    1. List<Log> logs
    )?,
  15. int? maxQueueSize = 100000,
})

Implementation

FileLogStorage({
  required this.directory,
  String? sessionId,
  this.meta,
  this.minLevel = LogLevels.all,
  this.maxTotalSize,
  int maxSessionSize = 10 * 1024 * 1024,
  this.maxChunkSize = 1024 * 1024,
  this.maxAge = const Duration(days: 7),
  FileLogDataFormat dataFormat = FileLogDataFormat.text,
  LogMainTheme? theme,
  LoggableConfig config = const LoggableConfig(),
  LoggableJsonConfig jsonConfig = const LoggableJsonConfig(),
  void Function(Object error, StackTrace stackTrace)? onError,
  void Function(List<Log> logs)? onDropped,
  int? maxQueueSize = 100000,
})  : maxSessionSize = _validateStorageSizes(
        maxChunkSize: maxChunkSize,
        maxSessionSize: maxSessionSize,
        maxTotalSize: maxTotalSize,
      ),
      _codec = FileLogCodec(
        dataFormat: dataFormat,
        theme: theme,
        config: config,
        jsonConfig: jsonConfig,
      ),
      _started = clock.now(),
      super(
        onError: onError,
        onDropped: onDropped,
        maxRetries: 0,
        maxQueueSize: _validateMaxQueueSize(maxQueueSize),
      ) {
  _sessionId = sanitizeSessionId(sessionId ?? defaultSessionId(_started));
  // Initialization starts in the background; its future is kept in
  // [ready].
  // ignore: discarded_futures
  ready = _init();
}