mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 10:14:45 +08:00
output log to files
This commit is contained in:
@ -1,16 +1,11 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
void dPrint(src) {
|
||||
if (kDebugMode) {
|
||||
print(src);
|
||||
}
|
||||
}
|
||||
|
||||
Future showToast(BuildContext context, String msg,
|
||||
{BoxConstraints? constraints, String? title}) async {
|
||||
return showBaseDialog(context,
|
||||
|
19
lib/common/utils/log.dart
Normal file
19
lib/common/utils/log.dart
Normal file
@ -0,0 +1,19 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:synchronized/synchronized.dart';
|
||||
|
||||
import '../conf/app_conf.dart';
|
||||
|
||||
var _logLock = Lock();
|
||||
|
||||
void dPrint(src) async {
|
||||
if (kDebugMode) {
|
||||
print(src);
|
||||
}
|
||||
try {
|
||||
await _logLock.synchronized(() async {
|
||||
await AppConf.appLogFile?.writeAsString("$src\n", mode: FileMode.append);
|
||||
});
|
||||
} catch (_) {}
|
||||
}
|
Reference in New Issue
Block a user