getLogDirectorySize static method
Implementation
static Future<int> getLogDirectorySize() async {
if (!_config.canWriteToFile) return 0;
if (_config.logDirectory == null) return 0;
final dir = _config.logDirectory!;
if (!await dir.exists()) return 0;
var total = 0;
await for (final entity in dir.list(recursive: false, followLinks: false)) {
if (entity is File && entity.path.endsWith('.log')) {
try {
final stat = await entity.stat();
total += stat.size;
} catch (_) {}
}
}
return total;
}