FileLogStorage constructor
FileLogStorage({
- required String directory,
- String? sessionId,
- Map<
String, Object?> ? meta, - int minLevel = LogLevels.all,
- int? maxTotalSize,
- int maxSessionSize = 10 * 1024 * 1024,
- int maxChunkSize = 1024 * 1024,
- Duration? maxAge = const Duration(days: 7),
- FileLogDataFormat dataFormat = FileLogDataFormat.text,
- LogMainTheme? theme,
- LoggableConfig config = const LoggableConfig(),
- LoggableJsonConfig jsonConfig = const LoggableJsonConfig(),
- void onError(
- Object error,
- StackTrace stackTrace
- void onDropped()?,
- 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();
}