feat: 清理日志

This commit is contained in:
YuanXuan 2025-09-12 11:20:41 +08:00
parent 747dba216f
commit c02486e072
4 changed files with 8 additions and 44 deletions

View File

@ -39,10 +39,6 @@ class YxNetInspectorController extends ChangeNotifier {
void initialize(YxNetInspectorConfig config) {
_config = config;
_showFloatingBall = config.showFloatingBall;
if (kDebugMode) {
debugPrint('🔍 YX 网络检查器已初始化');
}
}
///
@ -72,10 +68,6 @@ class YxNetInspectorController extends ChangeNotifier {
_requestCount++;
_trimLogs();
notifyListeners();
if (kDebugMode) {
debugPrint('📡 请求已记录: $method $url');
}
}
///
@ -117,12 +109,6 @@ class YxNetInspectorController extends ChangeNotifier {
}
notifyListeners();
if (kDebugMode) {
debugPrint(
'📨 响应已记录: $statusCode for ${originalLog.method} ${originalLog.url}',
);
}
}
///
@ -154,12 +140,6 @@ class YxNetInspectorController extends ChangeNotifier {
}
notifyListeners();
if (kDebugMode) {
debugPrint(
'❌ 错误已记录: $error for ${originalLog.method} ${originalLog.url}',
);
}
}
///
@ -170,10 +150,6 @@ class YxNetInspectorController extends ChangeNotifier {
_errorCount = 0;
_totalDuration = 0;
notifyListeners();
if (kDebugMode) {
debugPrint('🧹 所有日志已清空');
}
}
///

View File

@ -96,18 +96,12 @@ class _YxFloatingBallState extends State<YxFloatingBall>
OverlayState? overlay;
try {
overlay = Overlay.of(context, rootOverlay: true);
print('YxNetInspector: 成功找到根 Overlay');
} catch (e) {
print('YxNetInspector: 根 Overlay 查找失败: $e');
debugPrint('YxNetInspector: 根 Overlay 查找失败: $e');
// Overlay.of
overlay = _findOverlayInContext(context);
if (overlay != null) {
print('YxNetInspector: 手动查找 Overlay 成功');
} else {
print('YxNetInspector: 手动查找 Overlay 也失败');
}
}
if (overlay == null) {
// Overlay使
_showInspectorDialog();
@ -144,9 +138,8 @@ class _YxFloatingBallState extends State<YxFloatingBall>
overlay.insert(overlayEntry);
_currentOverlayEntry = overlayEntry;
print('YxNetInspector: 检查器面板显示成功');
} catch (e) {
print('YxNetInspector: 插入 OverlayEntry 失败: $e');
debugPrint('YxNetInspector: 插入 OverlayEntry 失败: $e');
//
setState(() {
_isExpanded = false;
@ -176,8 +169,7 @@ class _YxFloatingBallState extends State<YxFloatingBall>
void _createCustomOverlay() {
// Overlay
//
print('YxNetInspector: 无法找到 Overlay 上下文,请确保 YxNetInspector 在 MaterialApp 内部使用');
// SnackBar print
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
@ -190,9 +182,9 @@ class _YxFloatingBallState extends State<YxFloatingBall>
);
} catch (e) {
// ScaffoldMessenger
print('YxNetInspector: 无法显示检查器面板 - 请确保在 MaterialApp 内使用');
debugPrint('YxNetInspector: 无法显示检查器面板 - 请确保在 MaterialApp 内使用');
}
//
setState(() {
_isExpanded = false;

View File

@ -66,10 +66,6 @@ class _YxNetInspectorState extends State<YxNetInspector> {
//
_controller = YxNetInspectorController.instance;
_controller.initialize(widget.config);
if (kDebugMode) {
debugPrint('🔍 YX Net Inspector: App wrapper initialized');
}
}
@override

View File

@ -1,6 +1,6 @@
name: yx_net_inspector
description: A powerful network inspector with floating debug ball for Flutter apps. Monitor HTTP requests, responses, and debug network issues in real-time.
version: 1.0.0
version: 1.0.2
homepage: https://github.com/your-username/yx_net_inspector
environment:
@ -15,4 +15,4 @@ dev_dependencies:
flutter_test:
sdk: flutter
flutter: