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
    )?,
})

Implementation

FileLogStorage({
  required this.directory,
  String? sessionId,
  this.meta,
  this.minLevel = LogLevels.all,
  this.maxTotalSize,
  this.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(),
  super.onError,
})  : assert(maxChunkSize > 0, 'maxChunkSize must be positive'),
      assert(
        maxSessionSize >= 2 * maxChunkSize,
        'maxSessionSize must fit at least two chunks '
        '(maxSessionSize >= 2 * maxChunkSize)',
      ),
      assert(
        maxTotalSize == null || maxTotalSize >= maxSessionSize,
        'maxTotalSize must be >= maxSessionSize',
      ),
      _codec = FileLogCodec(
        dataFormat: dataFormat,
        theme: theme,
        config: config,
        jsonConfig: jsonConfig,
      ),
      _started = clock.now() {
  _sessionId = sanitizeSessionId(sessionId ?? defaultSessionId(_started));
  // Инициализация стартует в фоне, future сохраняется в [ready].
  // ignore: discarded_futures
  ready = _init();
}