添加日志 调试

This commit is contained in:
2025-10-24 21:03:48 +08:00
parent 6d4a4ff6a3
commit ae62457d8c
2 changed files with 27 additions and 27 deletions
@@ -90,7 +90,18 @@ class MethodHandler(private val scope: CoroutineScope) : FlutterPlugin,
scope.launch {
result.runCatching {
val args = call.arguments as String
// ✅ 添加日志
Log.d(TAG, "📍 changeHiddifyOptions 被调用")
Log.d(TAG, "⚙️ 接收到的配置长度: ${args.length}")
Log.d(TAG, "⚙️ 接收到的配置前500字符: ${args.substring(0, minOf(500, args.length))}")
Settings.configOptions = args
// 验证保存
val saved = Settings.configOptions
Log.d(TAG, "✅ 配置已保存,验证长度: ${saved.length}")
success(true)
}
}
@@ -102,10 +113,23 @@ class MethodHandler(private val scope: CoroutineScope) : FlutterPlugin,
val args = call.arguments as Map<*, *>
val path = args["path"] as String
val options = Settings.configOptions
// ✅ 添加详细日志
Log.d(TAG, "📍 GenerateConfig 被调用")
Log.d(TAG, "📁 配置文件路径: $path")
Log.d(TAG, "⚙️ configOptions 长度: ${options.length}")
Log.d(TAG, "⚙️ configOptions 内容: $options")
if (options.isBlank() || path.isBlank()) {
Log.e(TAG, "❌ 配置选项或路径为空!options.isBlank=${options.isBlank()}, path.isBlank=${path.isBlank()}")
error("blank properties")
}
Log.d(TAG, "🔧 开始调用 Mobile.buildConfig...")
val config = BoxService.buildConfig(path, options)
Log.d(TAG, "✅ buildConfig 完成,配置长度: ${config.length}")
Log.d(TAG, "📄 生成的配置前500字符: ${config.substring(0, minOf(500, config.length))}")
success(config)
}
}