fix: client log is not recorded (#141)

This commit is contained in:
Li Wei authored and GitHub committed 2023-07-06 17:15:48 +08:00
1 parent 9249613601
commit abe3cec13d
6 files changed
+23 -37

No files matched your search

@@ -35,7 +35,7 @@ class SettingView extends GetView<SettingController> {
debounceSave({bool needRestart = false}) {
var completer = Completer<void>();
timer?.cancel();
timer = Timer(const Duration(milliseconds: 500), () {
timer = Timer(const Duration(milliseconds: 1000), () {
appController
.saveConfig()
.then(completer.complete)
+9 -5
View File
@@ -1,19 +1,23 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:logger/logger.dart';
import 'util.dart';
final logger = Logger(
printer: PrettyPrinter(),
filter: ProductionFilter(),
printer: LogfmtPrinter(),
output: buildOutput(),
);
buildOutput() {
// if is debug mode, output to console
// if is debug mode, don't log to file
if (!kDebugMode && Util.isDesktop()) {
return FileOutput(file: File('log.txt'));
const logDirPath = 'logs';
var logDir = Directory(logDirPath);
if (!logDir.existsSync()) {
logDir.createSync();
}
return FileOutput(file: File('$logDirPath/client.log'));
}
return null;
}
+1 -1
View File
@@ -12,7 +12,7 @@ void showErrorMessage(msg) {
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
return;
}
Get.snackbar(title, msg);
Get.snackbar(title, msg.toString());
}
void showMessage(title, msg) {