mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
custom enable log
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -68,45 +68,50 @@ void main() async {
|
|||||||
Request();
|
Request();
|
||||||
await Request.setCookie();
|
await Request.setCookie();
|
||||||
RecommendFilter();
|
RecommendFilter();
|
||||||
// 异常捕获 logo记录
|
|
||||||
const String buildConfig = '''\n
|
if (GStorage.enableLog) {
|
||||||
|
// 异常捕获 logo记录
|
||||||
|
const String buildConfig = '''\n
|
||||||
Build Time: ${BuildConfig.buildTime}
|
Build Time: ${BuildConfig.buildTime}
|
||||||
Commit Hash: ${BuildConfig.commitHash}''';
|
Commit Hash: ${BuildConfig.commitHash}''';
|
||||||
final Catcher2Options debugConfig = Catcher2Options(
|
final Catcher2Options debugConfig = Catcher2Options(
|
||||||
SilentReportMode(),
|
SilentReportMode(),
|
||||||
[
|
[
|
||||||
FileHandler(await getLogsPath()),
|
FileHandler(await getLogsPath()),
|
||||||
ConsoleHandler(
|
ConsoleHandler(
|
||||||
enableDeviceParameters: false,
|
enableDeviceParameters: false,
|
||||||
enableApplicationParameters: false,
|
enableApplicationParameters: false,
|
||||||
enableCustomParameters: true,
|
enableCustomParameters: true,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
customParameters: {
|
customParameters: {
|
||||||
'BuildConfig': buildConfig,
|
'BuildConfig': buildConfig,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
final Catcher2Options releaseConfig = Catcher2Options(
|
final Catcher2Options releaseConfig = Catcher2Options(
|
||||||
SilentReportMode(),
|
SilentReportMode(),
|
||||||
[
|
[
|
||||||
FileHandler(await getLogsPath()),
|
FileHandler(await getLogsPath()),
|
||||||
ConsoleHandler(
|
ConsoleHandler(
|
||||||
enableCustomParameters: true,
|
enableCustomParameters: true,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
customParameters: {
|
customParameters: {
|
||||||
'BuildConfig': buildConfig,
|
'BuildConfig': buildConfig,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Catcher2(
|
Catcher2(
|
||||||
debugConfig: debugConfig,
|
debugConfig: debugConfig,
|
||||||
releaseConfig: releaseConfig,
|
releaseConfig: releaseConfig,
|
||||||
runAppFunction: () {
|
runAppFunction: () {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
runApp(const MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
// 小白条、导航栏沉浸
|
// 小白条、导航栏沉浸
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import 'dart:io';
|
|||||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||||
import 'package:PiliPlus/services/loggeer.dart';
|
import 'package:PiliPlus/services/loggeer.dart';
|
||||||
import 'package:PiliPlus/utils/page_utils.dart';
|
import 'package:PiliPlus/utils/page_utils.dart';
|
||||||
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
|
||||||
class LogsPage extends StatefulWidget {
|
class LogsPage extends StatefulWidget {
|
||||||
const LogsPage({super.key});
|
const LogsPage({super.key});
|
||||||
@@ -19,6 +21,7 @@ class _LogsPageState extends State<LogsPage> {
|
|||||||
late String fileContent;
|
late String fileContent;
|
||||||
List logsContent = [];
|
List logsContent = [];
|
||||||
DateTime? latestLog;
|
DateTime? latestLog;
|
||||||
|
late bool enableLog = GStorage.enableLog;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -114,6 +117,11 @@ class _LogsPageState extends State<LogsPage> {
|
|||||||
PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
onSelected: (String type) {
|
onSelected: (String type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case 'log':
|
||||||
|
enableLog = !enableLog;
|
||||||
|
GStorage.setting.put(SettingBoxKey.enableLog, enableLog);
|
||||||
|
SmartDialog.showToast('已${enableLog ? '开启' : '关闭'},重启生效');
|
||||||
|
break;
|
||||||
case 'copy':
|
case 'copy':
|
||||||
copyLogs();
|
copyLogs();
|
||||||
break;
|
break;
|
||||||
@@ -128,6 +136,10 @@ class _LogsPageState extends State<LogsPage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'log',
|
||||||
|
child: Text('${enableLog ? '关闭' : '开启'}日志'),
|
||||||
|
),
|
||||||
const PopupMenuItem<String>(
|
const PopupMenuItem<String>(
|
||||||
value: 'copy',
|
value: 'copy',
|
||||||
child: Text('复制日志'),
|
child: Text('复制日志'),
|
||||||
|
|||||||
@@ -497,6 +497,9 @@ class GStorage {
|
|||||||
static String get banWordForDyn =>
|
static String get banWordForDyn =>
|
||||||
GStorage.setting.get(SettingBoxKey.banWordForDyn, defaultValue: '');
|
GStorage.setting.get(SettingBoxKey.banWordForDyn, defaultValue: '');
|
||||||
|
|
||||||
|
static bool get enableLog =>
|
||||||
|
setting.get(SettingBoxKey.enableLog, defaultValue: true);
|
||||||
|
|
||||||
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
||||||
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: const [60.0, 40.0]));
|
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: const [60.0, 40.0]));
|
||||||
|
|
||||||
@@ -794,6 +797,7 @@ class SettingBoxKey {
|
|||||||
pageTransition = 'pageTransition',
|
pageTransition = 'pageTransition',
|
||||||
optTabletNav = 'optTabletNav',
|
optTabletNav = 'optTabletNav',
|
||||||
banWordForDyn = 'banWordForDyn',
|
banWordForDyn = 'banWordForDyn',
|
||||||
|
enableLog = 'enableLog',
|
||||||
|
|
||||||
// WebDAV
|
// WebDAV
|
||||||
webdavUri = 'webdavUri',
|
webdavUri = 'webdavUri',
|
||||||
|
|||||||
Reference in New Issue
Block a user