Browse Source

仅debug版启用文件日志

gjh 1 week ago
parent
commit
17ec3b9d6f
1 changed files with 3 additions and 4 deletions
  1. 3 4
      lib/funcs.dart

+ 3 - 4
lib/funcs.dart

@@ -42,10 +42,9 @@ Future<dynamic> initLog() async {
42 42
     if (!await dir.exists()) {
43 43
       await dir.create(recursive: true);
44 44
     }
45
-    File file =
46
-        File("${dir.path}/log_${DateTime.now().millisecondsSinceEpoch}.log");
47
-    output = MultiOutput(
48
-        [ConsoleOutput(), FileOutput(file: file, overrideExisting: true)]);
45
+    output = kDebugMode
46
+        ? MultiOutput([ConsoleOutput(), AdvancedFileOutput(path: dir.path)])
47
+        : ConsoleOutput();
49 48
   }
50 49
   logger = Logger(
51 50
       printer: PrettyPrinter(