initialize method
初始化文件管理器
Implementation
Future<void> initialize() async {
try {
_logsDirectory = Directory(storagePath);
// 确保日志目录存在
if (!await _logsDirectory.exists()) {
await _logsDirectory.create(recursive: true);
}
// 获取用户和设备信息
_currentUserId = await _getUserId();
_currentDeviceId = deviceInfo.deviceId;
if (config.enableDebugMode) {
debugPrint('📁 LogFileManager initialized');
debugPrint('📂 Storage path: $storagePath');
debugPrint('📱 Device ID: $_currentDeviceId');
debugPrint('👤 User ID: $_currentUserId');
}
} catch (e) {
if (config.enableDebugMode) {
debugPrint('❌ LogFileManager initialization failed: $e');
}
rethrow;
}
}